File: run_package_tests_in_same_loop.rst

package info (click to toggle)
python-pytest-asyncio 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 616 kB
  • sloc: python: 2,421; makefile: 24; sh: 1
file content (11 lines) | stat: -rw-r--r-- 536 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
========================================================
How to run all tests in a package in the same event loop
========================================================
All tests can be run inside the same event loop by marking them with ``pytest.mark.asyncio(loop_scope="package")``.
Add the following code to the ``__init__.py`` of the test package:

.. include:: package_scoped_loop_example.py
    :code: python

Note that this marker is not passed down to tests in subpackages.
Subpackages constitute their own, separate package.