From d581cf54cbb1df39e4dd846a01ab2f3dbe262f27 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 11 Nov 2020 15:40:54 +0100 Subject: [PATCH] Retain an assertion and update comments --- jupyterhub/app.py | 2 +- jupyterhub/tests/conftest.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jupyterhub/app.py b/jupyterhub/app.py index af394990..676198a6 100644 --- a/jupyterhub/app.py +++ b/jupyterhub/app.py @@ -930,7 +930,7 @@ class JupyterHub(Application): with an :meth:`authenticate` method that: - - is a coroutine (asyncio) + - is a coroutine (asyncio or tornado) - returns username on success, None on failure - takes two arguments: (handler, data), where `handler` is the calling web.RequestHandler, diff --git a/jupyterhub/tests/conftest.py b/jupyterhub/tests/conftest.py index c4c08b90..34c94e4f 100644 --- a/jupyterhub/tests/conftest.py +++ b/jupyterhub/tests/conftest.py @@ -55,10 +55,16 @@ _db = None def pytest_collection_modifyitems(items): - """add asyncio marker to all async tests""" + """This function is automatically run by pytest passing all collected test + functions. + + We use it to add asyncio marker to all async tests and assert we don't use + test functions that are async generators which wouldn't make sense. + """ for item in items: if inspect.iscoroutinefunction(item.obj): item.add_marker('asyncio') + assert not inspect.isasyncgenfunction(item.obj) @fixture(scope='module')