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

Test suite uses removed forbid_global_loop=True to pytest.mark.asyncio #1646

Open
mgorny opened this issue Aug 3, 2024 · 0 comments
Open

Comments

@mgorny
Copy link
Contributor

mgorny commented Aug 3, 2024

The tests are using @pytest.mark.asyncio(forbid_global_loop=True), e.g.:

@pytest.mark.asyncio(forbid_global_loop=True)

However, this parameter has been removed in 0.6.0 (back in 2017), and pytest-asyncio 0.24.0 (currently alpha) actually errors when it is specified:

$ USE_ASYNCIO=1 pytest autobahn/wamp/
/tmp/autobahn-python/.tox/py311-asyncio/lib/python3.11/site-packages/pytest_asyncio/plugin.py:212: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))

=============================================================== ERRORS ================================================================
___________________________________ ERROR collecting autobahn/wamp/test/test_wamp_component_aio.py ____________________________________
.tox/py311-asyncio/lib/python3.11/site-packages/pytest_asyncio/plugin.py:691: in _patched_collect
    return collector.__original_collect()
.tox/py311-asyncio/lib/python3.11/site-packages/_pytest/python.py:552: in collect
    return super().collect()
.tox/py311-asyncio/lib/python3.11/site-packages/_pytest/python.py:419: in collect
    res = ihook.pytest_pycollect_makeitem(
.tox/py311-asyncio/lib/python3.11/site-packages/pluggy/_hooks.py:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.tox/py311-asyncio/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.tox/py311-asyncio/lib/python3.11/site-packages/pytest_asyncio/plugin.py:576: in pytest_pycollect_makeitem_convert_async_functions_to_subclass
    ] = hook_result.get_result()
.tox/py311-asyncio/lib/python3.11/site-packages/_pytest/python.py:245: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
.tox/py311-asyncio/lib/python3.11/site-packages/_pytest/python.py:462: in _genfunctions
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
.tox/py311-asyncio/lib/python3.11/site-packages/pluggy/_hooks.py:574: in call_extra
    return self._hookexec(self.name, hookimpls, kwargs, firstresult)
.tox/py311-asyncio/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.tox/py311-asyncio/lib/python3.11/site-packages/pytest_asyncio/plugin.py:742: in pytest_generate_tests
    scope = _get_marked_loop_scope(marker)
.tox/py311-asyncio/lib/python3.11/site-packages/pytest_asyncio/plugin.py:1010: in _get_marked_loop_scope
    raise ValueError("mark.asyncio accepts only a keyword argument 'scope'.")
E   ValueError: mark.asyncio accepts only a keyword argument 'scope'.
========================================================== warnings summary ===========================================================
.tox/py311-asyncio/lib/python3.11/site-packages/passlib/utils/__init__.py:854
  /tmp/autobahn-python/.tox/py311-asyncio/lib/python3.11/site-packages/passlib/utils/__init__.py:854: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
    from crypt import crypt as _crypt

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================= short test summary info =======================================================
ERROR autobahn/wamp/test/test_wamp_component_aio.py - ValueError: mark.asyncio accepts only a keyword argument 'scope'.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

To reproduce (the easy way):

tox -e py311-asyncio
. .tox/py311-asyncio/bin/activate
pip install pytest-asyncio==0.24.0a0
USE_ASYNCIO=1 pytest autobahn/wamp/
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

1 participant