| 1 |
============= |
| 2 |
Configuration |
| 3 |
============= |
| 4 |
|
| 5 |
.. _configuration/asyncio_default_fixture_loop_scope: |
| 6 |
|
| 7 |
asyncio_default_fixture_loop_scope |
| 8 |
================================== |
| 9 |
Determines the default event loop scope of asynchronous fixtures. When this configuration option is unset, it defaults to the fixture scope. In future versions of pytest-asyncio, the value will default to ``function`` when unset. Possible values are: ``function``, ``class``, ``module``, ``package``, ``session`` |
| 10 |
|
| 11 |
.. _configuration/asyncio_default_test_loop_scope: |
| 12 |
|
| 13 |
asyncio_default_test_loop_scope |
| 14 |
=============================== |
| 15 |
Determines the default event loop scope of asynchronous tests. When this configuration option is unset, it default to function scope. Possible values are: ``function``, ``class``, ``module``, ``package``, ``session`` |
| 16 |
|
| 17 |
.. _configuration/asyncio_debug: |
| 18 |
|
| 19 |
asyncio_debug |
| 20 |
============= |
| 21 |
Enables `asyncio debug mode <https://docs.python.org/3/library/asyncio-dev.html#debug-mode>`_ for the default event loop used by asynchronous tests and fixtures. |
| 22 |
|
| 23 |
The debug mode can be set by the ``asyncio_debug`` configuration option in the `configuration file |
| 24 |
<https://docs.pytest.org/en/latest/reference/customize.html>`_: |
| 25 |
|
| 26 |
.. code-block:: ini |
| 27 |
|
| 28 |
# pytest.ini |
| 29 |
[pytest] |
| 30 |
asyncio_debug = true |
| 31 |
|
| 32 |
The value can also be set via the ``--asyncio-debug`` command-line option: |
| 33 |
|
| 34 |
.. code-block:: bash |
| 35 |
|
| 36 |
$ pytest tests --asyncio-debug |
| 37 |
|
| 38 |
By default, asyncio debug mode is disabled. |
| 39 |
|
| 40 |
asyncio_mode |
| 41 |
============ |
| 42 |
The pytest-asyncio mode can be set by the ``asyncio_mode`` configuration option in the `configuration file |
| 43 |
<https://docs.pytest.org/en/latest/reference/customize.html>`_: |
| 44 |
|
| 45 |
.. code-block:: ini |
| 46 |
|
| 47 |
# pytest.ini |
| 48 |
[pytest] |
| 49 |
asyncio_mode = auto |
| 50 |
|
| 51 |
The value can also be set via the ``--asyncio-mode`` command-line option: |
| 52 |
|
| 53 |
.. code-block:: bash |
| 54 |
|
| 55 |
$ pytest tests --asyncio-mode=strict |
| 56 |
|
| 57 |
|
| 58 |
If the asyncio mode is set in both the pytest configuration file and the command-line option, the command-line option takes precedence. If no asyncio mode is specified, the mode defaults to `strict`. |