Closed
Description
We seem to be having issued in our CI of Airflow (for example here) after bumping to pytest-asyncio
0.23.1 - it seemed to work fine in 0.23.0)
Example error here: https://github.com/apache/airflow/actions/runs/7079158331/job/19265706175?pr=36017
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/_pytest/main.py", line 271, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/_pytest/main.py", line 324, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pluggy/_result.py", line 114, in get_result
INTERNALERROR> raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/_pytest/main.py", line 335, in pytest_collection
INTERNALERROR> session.perform_collect()
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/_pytest/main.py", line 675, in perform_collect
INTERNALERROR> self.items.extend(self.genitems(node))
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/_pytest/main.py", line 845, in genitems
INTERNALERROR> yield from self.genitems(subnode)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/_pytest/main.py", line 842, in genitems
INTERNALERROR> rep = collect_one_node(node)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/_pytest/runner.py", line 546, in collect_one_node
INTERNALERROR> ihook.pytest_collectstart(collector=collector)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pluggy/_callers.py", line 113, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.__traceback__)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/lib/python3.8/site-packages/pytest_asyncio/plugin.py", line 612, in pytest_collectstart
INTERNALERROR> collector.obj.__pytest_asyncio_scoped_event_loop = scoped_event_loop
INTERNALERROR> AttributeError: 'NoneType' object has no attribute '__pytest_asyncio_scoped_event_loop'
This seems to be happening at collection time, so we are not eaven sure whcih test is causing it. It seems pretty relevant to recent changes in 0.23.0 and 0.23.1, but unforrtunately the message is pretty cryptic and it's hard to say what we should fix.
Any hints there? Or maybe an indication that there is still a bug around the scoped event loop ?