mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
apply asyncio patch before launching new loop for tests
This commit is contained in:
parent
29ec93627c
commit
7e2ae22aee
@ -140,9 +140,6 @@ class NotebookTestBase(TestCase):
|
||||
|
||||
started = Event()
|
||||
def start_thread():
|
||||
if 'asyncio' in sys.modules:
|
||||
import asyncio
|
||||
asyncio.set_event_loop(asyncio.new_event_loop())
|
||||
app = cls.notebook = NotebookApp(
|
||||
port=cls.port,
|
||||
port_retries=0,
|
||||
@ -156,6 +153,10 @@ class NotebookTestBase(TestCase):
|
||||
allow_root=True,
|
||||
token=cls.token,
|
||||
)
|
||||
if 'asyncio' in sys.modules:
|
||||
app._init_asyncio_patch()
|
||||
import asyncio
|
||||
asyncio.set_event_loop(asyncio.new_event_loop())
|
||||
# don't register signal handler during tests
|
||||
app.init_signal = lambda : None
|
||||
# clear log handlers and propagate to root for nose to capture it
|
||||
|
Loading…
Reference in New Issue
Block a user