mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 06:52:59 +00:00
use run_sync to run coroutines in sync contexts
allows using py.test stuff in spawner/auth tests
This commit is contained in:
@@ -363,12 +363,8 @@ class JupyterHubApp(Application):
|
||||
except KeyboardInterrupt:
|
||||
print("\nInterrupted")
|
||||
finally:
|
||||
# have to install/start a new IOLoop briefly,
|
||||
# to allow for async cleanup code.
|
||||
IOLoop.clear_instance()
|
||||
cleanup_loop = IOLoop.instance()
|
||||
cleanup_loop.add_callback(self.cleanup)
|
||||
cleanup_loop.start()
|
||||
# run the cleanup step (in a new loop, because the interrupted one is unclean)
|
||||
IOLoop().run_sync(self.cleanup)
|
||||
|
||||
main = JupyterHubApp.launch_instance
|
||||
|
||||
|
Reference in New Issue
Block a user