Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
evalott100 opened this issue Dec 5, 2023 · 2 comments
Open

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

evalott100 opened this issue Dec 5, 2023 · 2 comments
Assignees

Comments

@evalott100
Copy link
Contributor

evalott100 commented Dec 5, 2023

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...

@AlexanderWells-diamond
Copy link
Contributor

There was a breaking change in version 0.23.0. See issue and discussion about it here: pytest-dev/pytest-asyncio#706

@evalott100
Copy link
Contributor Author

evalott100 commented Dec 5, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants