Skip to content

Tests fail to run when pytest-asyncio>0.14.0 installed in environment #6433

@jacobtomlinson

Description

@jacobtomlinson

A while ago distributed dropped pytest-asyncio in favour of gen_test (see #6050). Other projects in the Dask ecosystem continue to use pytest-asyncio and I've noticed recently that having pytest-asyncio>0.14.0 simply installed in the conda env causes the distributed tests to fail.

Error when running tests
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/_pytest/main.py", line 264, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/_pytest/config/__init__.py", line 992, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/pytest_asyncio/plugin.py", line 191, in pytest_configure
INTERNALERROR>     config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)
INTERNALERROR>   File "/Users/jtomlinson/miniconda3/envs/dask/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1339, in issue_config_time_warning
INTERNALERROR>     warnings.warn(warning, stacklevel=stacklevel)
INTERNALERROR> DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.

I typically have a development conda env with many Dask projects installed from source. Something must've bumped the pytest-asyncio version and with the pin in distributed gone I have to manually downgrade.

Once quick fix for this seems to be to add asyncio_mode=strict to the pytest section in setup.cfg. But that's a little frustrating given that we don't even use it here.

Another option is to go through the other Dask subprojects and remove pytest-asyncio in favour of something else. But that does open up a bunch of additional work.

Given that @fjetter and @graingert made this change I'm keen to get your advice on a good course of action here? #6050 and #6063 are pretty information light so it would be good to know what the issues were that caused it to be removed because I expect the same problems to be happening in other projects. Is it ok to rely on gen_test in other projects that have distributed as a dependency?

Metadata

Metadata

Assignees

No one assigned

    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