| 1 |
====================================== |
| 2 |
How to test with different event loops |
| 3 |
====================================== |
| 4 |
|
| 5 |
.. warning:: |
| 6 |
|
| 7 |
Overriding the *event_loop_policy* fixture is deprecated and will be removed in a future version of pytest-asyncio. Use the ``pytest_asyncio_loop_factories`` hook instead. See :doc:`custom_loop_factory` for details. |
| 8 |
|
| 9 |
Parametrizing the *event_loop_policy* fixture parametrizes all async tests. The following example causes all async tests to run multiple times, once for each event loop in the fixture parameters: |
| 10 |
|
| 11 |
.. include:: multiple_loops_example.py |
| 12 |
:code: python |
| 13 |
|
| 14 |
You may choose to limit the scope of the fixture to *package,* *module,* or *class,* if you only want a subset of your tests to run with different event loops. |