Debian Codegraph @

docs/how-to-guides/change_default_fixture_loop.rst

raw
1 ==========================================================
2 How to change the default event loop scope of all fixtures
3 ==========================================================
4 The :ref:`configuration/asyncio_default_fixture_loop_scope` configuration option sets the default event loop scope for asynchronous fixtures. The following code snippets configure all fixtures to run in a session-scoped loop by default:
5
6 .. tabs::
7
8 .. tab:: pytest.ini
9
10 .. code-block:: ini
11
12 [pytest]
13 asyncio_default_fixture_loop_scope = session
14
15 .. tab:: pyproject.toml
16
17 .. code-block:: toml
18
19 [tool.pytest.ini_options]
20 asyncio_default_fixture_loop_scope = "session"
21
22 .. tab:: setup.cfg
23
24 .. code-block:: ini
25
26 [tool:pytest]
27 asyncio_default_fixture_loop_scope = session
28
29 Please refer to :ref:`configuration/asyncio_default_fixture_loop_scope` for other valid scopes.