Skip to content

New release of pytest-asyncio causes tests to fail #84

Open
@evvaaaa

Description

@evvaaaa

Tests fail when awaiting aioca coroutines:

Traceback (most recent call last):
  File "/scratch/twj43146/Programming/PandABlocks-ioc-fork/.venv/lib/python3.10/site-packages/_pytest/runner.py", line 341, in from_call
    result: Optional[TResult] = func()
  File "/scratch/twj43146/Programming/PandABlocks-ioc-fork/.venv/lib/python3.10/site-packages/_pytest/runner.py", line 262, in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
  File "/scratch/twj43146/Programming/PandABlocks-ioc-fork/.venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 493, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/scratch/twj43146/Programming/PandABlocks-ioc-fork/.venv/lib/python3.10/site-packages/pluggy/_manager.py", line 115, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/scratch/twj43146/Programming/PandABlocks-ioc-fork/.venv/lib/python3.10/site-packages/pluggy/_callers.py", line 130, in _multicall
    teardown[0].send(outcome)
  File "/scratch/twj43146/Programming/PandABlocks-ioc-fork/.venv/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 93, in pytest_runtest_teardown
    yield from unraisable_exception_runtest_hook()
  File "/scratch/twj43146/Programming/PandABlocks-ioc-fork/.venv/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 78, in unraisable_exception_runtest_hook
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
pytest.PytestUnraisableExceptionWarning: Exception ignored on calling ctypes callback function: <function Channel.on_ca_connect at 0x7f508354af80>

Traceback (most recent call last):
  File "/scratch/twj43146/Programming/PandABlocks-ioc-fork/.venv/lib/python3.10/site-packages/aioca/_catools.py", line 207, in on_ca_connect
    self.__event_loop.call_soon_threadsafe(self.on_ca_connect_, op)
  File "/dls_sw/apps/python/miniforge/4.10.0-0/envs/python3.10/lib/python3.10/asyncio/base_events.py", line 798, in call_soon_threadsafe
    self._check_closed()
  File "/dls_sw/apps/python/miniforge/4.10.0-0/envs/python3.10/lib/python3.10/asyncio/base_events.py", line 515, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

... is the failure all the tests using the mocked panda with aioca have.

After some digging I realised it's the latest release of pytest-asyncio causing this.

In the short term I'll pin pytest-asyncio to the previous version. We should figure out why this is happening though...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions