| 1 |
======================================================== |
| 2 |
How to run all tests in a package in the same event loop |
| 3 |
======================================================== |
| 4 |
All tests can be run inside the same event loop by marking them with ``pytest.mark.asyncio(loop_scope="package")``. |
| 5 |
Add the following code to the ``__init__.py`` of the test package: |
| 6 |
|
| 7 |
.. include:: package_scoped_loop_example.py |
| 8 |
:code: python |
| 9 |
|
| 10 |
Note that this marker is not passed down to tests in subpackages. |
| 11 |
Subpackages constitute their own, separate package. |