Skip to content

Commit 7e2ae22

Browse files
committed
apply asyncio patch before launching new loop for tests
1 parent 29ec936 commit 7e2ae22

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

notebook/tests/launchnotebook.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ def tmp(*parts):
140140

141141
started = Event()
142142
def start_thread():
143-
if 'asyncio' in sys.modules:
144-
import asyncio
145-
asyncio.set_event_loop(asyncio.new_event_loop())
146143
app = cls.notebook = NotebookApp(
147144
port=cls.port,
148145
port_retries=0,
@@ -156,6 +153,10 @@ def start_thread():
156153
allow_root=True,
157154
token=cls.token,
158155
)
156+
if 'asyncio' in sys.modules:
157+
app._init_asyncio_patch()
158+
import asyncio
159+
asyncio.set_event_loop(asyncio.new_event_loop())
159160
# don't register signal handler during tests
160161
app.init_signal = lambda : None
161162
# clear log handlers and propagate to root for nose to capture it

0 commit comments

Comments
 (0)