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:
=============================================================== ERRORS ================================================================
________________________________________ ERROR collecting tests/test_asyncio/test_scripting.py ________________________________________
[…]
/usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:742: in pytest_generate_tests
scope = _get_marked_loop_scope(marker)
marker = Mark(name='asyncio', args=(), kwargs={'forbid_global_loop': True})
metafunc = <_pytest.python.Metafunc object at 0x7f10dbfd8c80>
/usr/lib/python3.12/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'.
asyncio_marker = Mark(name='asyncio', args=(), kwargs={'forbid_global_loop': True})
Note that htere are some other deprecation warnings too:
tests/test_asyncio/test_lock.py:107
tests/test_asyncio/test_lock.py:107: PytestDeprecationWarning: test_blocking_timeout[single] is asynchronous and explicitly requests
the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
async def test_blocking_timeout(self, r, event_loop):
tests/test_asyncio/test_lock.py:107
tests/test_asyncio/test_lock.py:107: PytestDeprecationWarning: test_blocking_timeout[pool] is asynchronous and explicitly requests th
e "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
async def test_blocking_timeout(self, r, event_loop):
Version: redis-py 5.0.8, redis n/a
Platform: Gentoo Linux amd64, Python 3.12.4
Description:
The tests are using
@pytest.mark.asyncio(forbid_global_loop=True)
, e.g.:https://github.com/redis/redis-py/blob/fb74aa2806100f4026e290dab0cb7164262ff142/tests/test_asyncio/test_scripting.py#L31
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:
Note that htere are some other deprecation warnings too: