Skip to content

Commit 37899df

Browse files
committed
Silence Pytest deprecation warning about async fixture loop
With Pytest version 8.3.3 and pytest-asyncio 0.24.0 in Python 3.10 (and possibly other versions), we get this deprecation warning when running `check/pytest`: ``` [...]/python3.10/site-packages/pytest_asyncio/plugin.py:208: 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" ``` This warning is essentially useless for our purposes, and only causes unnecessary confusion about what's going on. Based on the discussion at <pytest-dev/pytest-asyncio#924>, a simple way to silence the deprecation warning is to add an option to `pyproject.toml`.
1 parent d85d92b commit 37899df

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ markers = [
1414
"slow: slow tests that should be skipped by default.",
1515
"weekly: tests to be run only by weekly CI automation.",
1616
]
17+
# Silence deprecation warnings about option "asyncio_default_fixture_loop_scope"
18+
asyncio_default_fixture_loop_scope = "function"

0 commit comments

Comments
 (0)