mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-07 01:54:09 +00:00
avoid stopping event loop in app fixture
let pytest-asyncio do it
This commit is contained in:
@@ -3887,6 +3887,10 @@ class JupyterHub(Application):
|
|||||||
tasks = [t for t in asyncio.all_tasks()]
|
tasks = [t for t in asyncio.all_tasks()]
|
||||||
for t in tasks:
|
for t in tasks:
|
||||||
self.log.debug("Task status: %s", t)
|
self.log.debug("Task status: %s", t)
|
||||||
|
self._stop_event_loop()
|
||||||
|
|
||||||
|
def _stop_event_loop(self):
|
||||||
|
"""In a method to allow tests to not do this"""
|
||||||
asyncio.get_event_loop().stop()
|
asyncio.get_event_loop().stop()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
@@ -382,6 +382,10 @@ class MockHub(JupyterHub):
|
|||||||
super().stop()
|
super().stop()
|
||||||
self.db_file.close()
|
self.db_file.close()
|
||||||
|
|
||||||
|
def _stop_event_loop(self):
|
||||||
|
# leave it to pytest-asyncio to stop the loop
|
||||||
|
pass
|
||||||
|
|
||||||
async def login_user(self, name):
|
async def login_user(self, name):
|
||||||
"""Login a user by name, returning her cookies."""
|
"""Login a user by name, returning her cookies."""
|
||||||
base_url = public_url(self)
|
base_url = public_url(self)
|
||||||
|
Reference in New Issue
Block a user