Skip to content

Commit

Permalink
Merge pull request #28 from mariusvniekerk/orderindependent
Browse files Browse the repository at this point in the history
Made stdout/stderr tests less order dependent.
  • Loading branch information
takluyver authored Jan 30, 2017
2 parents 20500de + 20263fd commit 713e891
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions jupyter_kernel_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ def test_execute_stdout(self):
self.assertEqual(reply['content']['status'], 'ok')

self.assertGreaterEqual(len(output_msgs), 1)
self.assertEqual(output_msgs[0]['msg_type'], 'stream')
self.assertEqual(output_msgs[0]['content']['name'], 'stdout')
self.assertIn('hello, world', output_msgs[0]['content']['text'])
for msg in output_msgs:
if (msg['msg_type'] == 'stream') and (msg['content']['name'] == 'stdout'):
self.assertIn('hello, world', msg['content']['text'])
break
else:
self.assertTrue(False, "Expected one output message of type 'stream' and 'content.name'='stdout'")

code_stderr = ""

Expand All @@ -110,8 +113,12 @@ def test_execute_stderr(self):
self.assertEqual(reply['content']['status'], 'ok')

self.assertGreaterEqual(len(output_msgs), 1)
self.assertEqual(output_msgs[0]['msg_type'], 'stream')
self.assertEqual(output_msgs[0]['content']['name'], 'stderr')

for msg in output_msgs:
if (msg['msg_type'] == 'stream') and (msg['content']['name'] == 'stderr'):
break
else:
self.assertTrue(False, "Expected one output message of type 'stream' and 'content.name'='stderr'")

completion_samples = []

Expand Down

0 comments on commit 713e891

Please sign in to comment.