Skip to content

Commit d27c8bb

Browse files
author
Quentin Peter
committed
Merge branch 'repeat_tests' into _wait_input_request_reply
2 parents b2bd633 + 7fe1869 commit d27c8bb

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

ipykernel/kernelbase.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,6 @@ def should_handle(self, stream, msg, idents):
225225
@gen.coroutine
226226
def dispatch_shell(self, stream, msg):
227227
"""dispatch shell requests"""
228-
# flush control requests first
229-
if self.control_stream:
230-
self.control_stream.flush()
231-
232228
idents, msg = self.session.feed_identities(msg, copy=False)
233229
try:
234230
msg = self.session.deserialize(msg, content=True, copy=False)
@@ -373,6 +369,9 @@ def dispatch_queue(self):
373369
"""
374370

375371
while True:
372+
# ensure control stream is flushed before processing shell messages
373+
if self.control_stream:
374+
self.control_stream.flush()
376375
# receive the next message and handle it
377376
try:
378377
yield self.process_one()

ipykernel/tests/test_embed_kernel.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from contextlib import contextmanager
1111
from subprocess import Popen, PIPE
12+
from flaky import flaky
1213

1314
from jupyter_client import BlockingKernelClient
1415
from jupyter_core import paths
@@ -61,6 +62,8 @@ def setup_kernel(cmd):
6162
client.stop_channels()
6263
kernel.terminate()
6364

65+
66+
@flaky(max_runs=3)
6467
def test_embed_kernel_basic():
6568
"""IPython.embed_kernel() is basically functional"""
6669
cmd = '\n'.join([
@@ -93,6 +96,8 @@ def test_embed_kernel_basic():
9396
text = content['data']['text/plain']
9497
assert '10' in text
9598

99+
100+
@flaky(max_runs=3)
96101
def test_embed_kernel_namespace():
97102
"""IPython.embed_kernel() inherits calling namespace"""
98103
cmd = '\n'.join([
@@ -128,6 +133,7 @@ def test_embed_kernel_namespace():
128133
content = msg['content']
129134
assert not content['found']
130135

136+
@flaky(max_runs=3)
131137
def test_embed_kernel_reentrant():
132138
"""IPython.embed_kernel() can be called multiple times"""
133139
cmd = '\n'.join([

ipykernel/tests/test_start_kernel.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
from .test_embed_kernel import setup_kernel
2+
from flaky import flaky
23

34
TIMEOUT = 15
45

6+
7+
@flaky(max_runs=3)
58
def test_ipython_start_kernel_userns():
69
cmd = ('from IPython import start_kernel\n'
710
'ns = {"tre": 123}\n'
@@ -27,6 +30,8 @@ def test_ipython_start_kernel_userns():
2730
text = content['data']['text/plain']
2831
assert u'DummyMod' in text
2932

33+
34+
@flaky(max_runs=3)
3035
def test_ipython_start_kernel_no_userns():
3136
# Issue #4188 - user_ns should be passed to shell as None, not {}
3237
cmd = ('from IPython import start_kernel\n'

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def run(self):
9797
'test': [
9898
'pytest',
9999
'pytest-cov',
100+
'flaky',
100101
'nose', # nose because there are still a few nose.tools imports hanging around
101102
],
102103
},

0 commit comments

Comments
 (0)