aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
436 stars 189 forks source link

Tests fail for `pytest-asyncio==0.17.0` #5310

Open sphuber opened 2 years ago

sphuber commented 2 years ago

Since pytest-asyncio==0.17.0 was released on January 13th, the tests are broken. See this build as an example. Tests are failing because the loop is closed (see exception below). This may be because they changed the way async tests are automatically marked in the new version and now the event loop that gets used automatically gets closed after each test.

________________ TestInterruptableTask.test_future_already_set _________________

kwargs = {}
coro = <coroutine object TestInterruptableTask.test_future_already_set at 0x7f0a5d867440>

    @functools.wraps(func)
    def inner(**kwargs):
        coro = func(**kwargs)
        if coro is not None:
>           task = asyncio.ensure_future(coro, loop=_loop)

/opt/hostedtoolcache/Python/3.9.9/x64/lib/python3.9/site-packages/pytest_asyncio/plugin.py:317: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.9.9/x64/lib/python3.9/asyncio/tasks.py:669: in ensure_future
    task = loop.create_task(coro_or_future)
/opt/hostedtoolcache/Python/3.9.9/x64/lib/python3.9/asyncio/base_events.py:431: in create_task
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=True debug=False>

    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed

/opt/hostedtoolcache/Python/3.9.9/x64/lib/python3.9/asyncio/base_events.py:510: RuntimeError
sphuber commented 2 years ago

@muhrin would be good if you could have a look

sphuber commented 2 years ago

A upper limit was temporarily imposed in #5309