pytest-asyncio 1.2.0__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/PKG-INFO +7 -7
  2. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/README.rst +2 -2
  3. pytest_asyncio-1.4.0/constraints.txt +67 -0
  4. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/dependencies/pytest-min/constraints.txt +1 -1
  5. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/dependencies/pytest-min/requirements.txt +1 -1
  6. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/concepts.rst +34 -14
  7. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/conf.py +1 -1
  8. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/change_default_fixture_loop.rst +17 -12
  9. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/change_default_test_loop.rst +19 -13
  10. pytest_asyncio-1.4.0/docs/how-to-guides/configure_loop_factories_per_test/conftest.py +18 -0
  11. pytest_asyncio-1.4.0/docs/how-to-guides/configure_loop_factories_per_test/test_extra_loop_factories.py +11 -0
  12. pytest_asyncio-1.4.0/docs/how-to-guides/configure_loop_factories_per_test.rst +29 -0
  13. pytest_asyncio-1.4.0/docs/how-to-guides/custom_loop_factory.rst +26 -0
  14. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/index.rst +3 -0
  15. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/migrate_from_0_23.rst +2 -0
  16. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/multiple_loops.rst +4 -0
  17. pytest_asyncio-1.4.0/docs/how-to-guides/run_test_with_specific_loop_factories/conftest.py +12 -0
  18. pytest_asyncio-1.4.0/docs/how-to-guides/run_test_with_specific_loop_factories/test_loop_factories_subset.py +11 -0
  19. pytest_asyncio-1.4.0/docs/how-to-guides/run_test_with_specific_loop_factories.rst +23 -0
  20. pytest_asyncio-1.4.0/docs/how-to-guides/uvloop.rst +41 -0
  21. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/changelog.rst +71 -1
  22. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/fixtures/index.rst +5 -0
  23. pytest_asyncio-1.4.0/docs/reference/hooks.rst +16 -0
  24. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/index.rst +1 -0
  25. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/markers/index.rst +18 -9
  26. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pyproject.toml +4 -4
  27. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pytest_asyncio/plugin.py +276 -38
  28. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pytest_asyncio.egg-info/PKG-INFO +7 -7
  29. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pytest_asyncio.egg-info/SOURCES.txt +9 -1
  30. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pytest_asyncio.egg-info/requires.txt +2 -1
  31. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/async_fixtures/test_async_fixtures_contextvars.py +20 -65
  32. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/async_fixtures/test_shared_module_fixture.py +6 -12
  33. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/hypothesis/test_base.py +7 -19
  34. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/markers/test_class_scope.py +39 -58
  35. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/markers/test_function_scope.py +86 -68
  36. pytest_asyncio-1.4.0/tests/markers/test_invalid_arguments.py +108 -0
  37. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/markers/test_mixed_scope.py +2 -6
  38. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/markers/test_module_scope.py +43 -60
  39. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/markers/test_package_scope.py +52 -71
  40. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/markers/test_session_scope.py +59 -90
  41. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/modes/test_auto_mode.py +14 -42
  42. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/modes/test_strict_mode.py +33 -52
  43. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_asyncio_debug.py +20 -60
  44. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_asyncio_fixture.py +2 -6
  45. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_asyncio_mark.py +36 -73
  46. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_doctest.py +4 -8
  47. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_event_loop_fixture.py +9 -71
  48. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_fixture_loop_scopes.py +22 -49
  49. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_import.py +10 -22
  50. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_is_async_test.py +8 -24
  51. pytest_asyncio-1.4.0/tests/test_loop_factory_parametrization.py +919 -0
  52. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_port_factories.py +8 -24
  53. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_set_event_loop.py +114 -63
  54. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_simple.py +4 -12
  55. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_skips.py +16 -44
  56. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_task_cleanup.py +2 -6
  57. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tox.ini +8 -3
  58. pytest_asyncio-1.2.0/constraints.txt +0 -66
  59. pytest_asyncio-1.2.0/docs/how-to-guides/uvloop.rst +0 -18
  60. pytest_asyncio-1.2.0/docs/reference/markers/class_scoped_loop_custom_policies_strict_mode_example.py +0 -23
  61. pytest_asyncio-1.2.0/tests/markers/test_invalid_arguments.py +0 -87
  62. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/.readthedocs.yaml +0 -0
  63. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/LICENSE +0 -0
  64. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/MANIFEST.in +0 -0
  65. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/Makefile +0 -0
  66. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/SECURITY.rst +0 -0
  67. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/changelog.d/.gitkeep +0 -0
  68. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/dependencies/docs/constraints.txt +0 -0
  69. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/concepts_concurrent_execution_example.py +0 -0
  70. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/concepts_function_scope_example.py +0 -0
  71. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/concepts_module_scope_example.py +0 -0
  72. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/change_fixture_loop.rst +0 -0
  73. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/change_fixture_loop_example.py +0 -0
  74. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/class_scoped_loop_example.py +0 -0
  75. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/migrate_from_0_21.rst +0 -0
  76. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/module_scoped_loop_example.py +0 -0
  77. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/multiple_loops_example.py +0 -0
  78. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/package_scoped_loop_example.py +0 -0
  79. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/parametrize_with_asyncio.rst +0 -0
  80. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/parametrize_with_asyncio_example.py +0 -0
  81. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/run_class_tests_in_same_loop.rst +0 -0
  82. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/run_module_tests_in_same_loop.rst +0 -0
  83. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/run_package_tests_in_same_loop.rst +0 -0
  84. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/test_item_is_async.rst +0 -0
  85. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/how-to-guides/test_item_is_async_example.py +0 -0
  86. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/index.rst +0 -0
  87. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/configuration.rst +0 -0
  88. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/decorators/index.rst +0 -0
  89. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/decorators/pytest_asyncio_fixture_example.py +0 -0
  90. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/fixtures/event_loop_policy_example.py +0 -0
  91. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/fixtures/event_loop_policy_parametrized_example.py +0 -0
  92. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/functions.rst +0 -0
  93. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/markers/class_scoped_loop_strict_mode_example.py +0 -0
  94. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/markers/class_scoped_loop_with_fixture_strict_mode_example.py +0 -0
  95. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/markers/function_scoped_loop_pytestmark_strict_mode_example.py +0 -0
  96. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/markers/function_scoped_loop_strict_mode_example.py +0 -0
  97. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/reference/markers/module_scoped_loop_strict_mode_example.py +0 -0
  98. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/docs/support.rst +0 -0
  99. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pytest_asyncio/__init__.py +0 -0
  100. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pytest_asyncio/py.typed +0 -0
  101. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pytest_asyncio.egg-info/dependency_links.txt +0 -0
  102. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pytest_asyncio.egg-info/entry_points.txt +0 -0
  103. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/pytest_asyncio.egg-info/top_level.txt +0 -0
  104. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/setup.cfg +0 -0
  105. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/__init__.py +0 -0
  106. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/async_fixtures/__init__.py +0 -0
  107. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/async_fixtures/test_async_fixtures.py +0 -0
  108. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/async_fixtures/test_nested.py +0 -0
  109. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/conftest.py +0 -0
  110. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/hypothesis/__init__.py +0 -0
  111. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/markers/__init__.py +0 -0
  112. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/modes/__init__.py +0 -0
  113. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_package.py +0 -0
  114. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tests/test_subprocess.py +0 -0
  115. {pytest_asyncio-1.2.0 → pytest_asyncio-1.4.0}/tools/get-version.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-asyncio
3
- Version: 1.2.0
3
+ Version: 1.4.0
4
4
  Summary: Pytest support for asyncio
5
5
  Author-email: Tin Tvrtković <tinchester@gmail.com>
6
6
  Maintainer-email: Michael Seifert <m.seifert@digitalernachschub.de>
7
7
  License-Expression: Apache-2.0
8
8
  Project-URL: Bug Tracker, https://github.com/pytest-dev/pytest-asyncio/issues
9
- Project-URL: Changelog, https://pytest-asyncio.readthedocs.io/en/latest/reference/changelog.html
9
+ Project-URL: Changelog, https://pytest-asyncio.readthedocs.io/en/stable/reference/changelog.html
10
10
  Project-URL: Documentation, https://pytest-asyncio.readthedocs.io
11
11
  Project-URL: Homepage, https://github.com/pytest-dev/pytest-asyncio
12
12
  Project-URL: Source Code, https://github.com/pytest-dev/pytest-asyncio
@@ -15,7 +15,6 @@ Classifier: Framework :: AsyncIO
15
15
  Classifier: Framework :: Pytest
16
16
  Classifier: Intended Audience :: Developers
17
17
  Classifier: Programming Language :: Python :: 3 :: Only
18
- Classifier: Programming Language :: Python :: 3.9
19
18
  Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
21
20
  Classifier: Programming Language :: Python :: 3.12
@@ -23,15 +22,16 @@ Classifier: Programming Language :: Python :: 3.13
23
22
  Classifier: Programming Language :: Python :: 3.14
24
23
  Classifier: Topic :: Software Development :: Testing
25
24
  Classifier: Typing :: Typed
26
- Requires-Python: >=3.9
25
+ Requires-Python: >=3.10
27
26
  Description-Content-Type: text/x-rst
28
27
  License-File: LICENSE
29
28
  Requires-Dist: backports-asyncio-runner<2,>=1.1; python_version < "3.11"
30
- Requires-Dist: pytest<9,>=8.2
29
+ Requires-Dist: pytest<10,>=8.4
31
30
  Requires-Dist: typing-extensions>=4.12; python_version < "3.13"
32
31
  Provides-Extra: docs
33
32
  Requires-Dist: sphinx>=5.3; extra == "docs"
34
33
  Requires-Dist: sphinx-rtd-theme>=1; extra == "docs"
34
+ Requires-Dist: sphinx-tabs>=3.5; extra == "docs"
35
35
  Provides-Extra: testing
36
36
  Requires-Dist: coverage>=6.2; extra == "testing"
37
37
  Requires-Dist: hypothesis>=5.7.1; extra == "testing"
@@ -53,7 +53,7 @@ pytest-asyncio
53
53
  :alt: Matrix chat room: #pytest-asyncio
54
54
  :target: https://matrix.to/#/#pytest-asyncio:matrix.org
55
55
 
56
- `pytest-asyncio <https://pytest-asyncio.readthedocs.io/en/latest/>`_ is a `pytest <https://docs.pytest.org/en/latest/contents.html>`_ plugin. It facilitates testing of code that uses the `asyncio <https://docs.python.org/3/library/asyncio.html>`_ library.
56
+ `pytest-asyncio <https://pytest-asyncio.readthedocs.io/en/stable/>`_ is a `pytest <https://docs.pytest.org/en/latest/contents.html>`_ plugin. It facilitates testing of code that uses the `asyncio <https://docs.python.org/3/library/asyncio.html>`_ library.
57
57
 
58
58
  Specifically, pytest-asyncio provides support for coroutines as test functions. This allows users to *await* code inside their tests. For example, the following code is executed as a test item by pytest:
59
59
 
@@ -64,7 +64,7 @@ Specifically, pytest-asyncio provides support for coroutines as test functions.
64
64
  res = await library.do_something()
65
65
  assert b"expected result" == res
66
66
 
67
- More details can be found in the `documentation <https://pytest-asyncio.readthedocs.io/en/latest/>`_.
67
+ More details can be found in the `documentation <https://pytest-asyncio.readthedocs.io/en/stable/>`_.
68
68
 
69
69
  Note that test classes subclassing the standard `unittest <https://docs.python.org/3/library/unittest.html>`__ library are not supported. Users
70
70
  are advised to use `unittest.IsolatedAsyncioTestCase <https://docs.python.org/3/library/unittest.html#unittest.IsolatedAsyncioTestCase>`__
@@ -14,7 +14,7 @@ pytest-asyncio
14
14
  :alt: Matrix chat room: #pytest-asyncio
15
15
  :target: https://matrix.to/#/#pytest-asyncio:matrix.org
16
16
 
17
- `pytest-asyncio <https://pytest-asyncio.readthedocs.io/en/latest/>`_ is a `pytest <https://docs.pytest.org/en/latest/contents.html>`_ plugin. It facilitates testing of code that uses the `asyncio <https://docs.python.org/3/library/asyncio.html>`_ library.
17
+ `pytest-asyncio <https://pytest-asyncio.readthedocs.io/en/stable/>`_ is a `pytest <https://docs.pytest.org/en/latest/contents.html>`_ plugin. It facilitates testing of code that uses the `asyncio <https://docs.python.org/3/library/asyncio.html>`_ library.
18
18
 
19
19
  Specifically, pytest-asyncio provides support for coroutines as test functions. This allows users to *await* code inside their tests. For example, the following code is executed as a test item by pytest:
20
20
 
@@ -25,7 +25,7 @@ Specifically, pytest-asyncio provides support for coroutines as test functions.
25
25
  res = await library.do_something()
26
26
  assert b"expected result" == res
27
27
 
28
- More details can be found in the `documentation <https://pytest-asyncio.readthedocs.io/en/latest/>`_.
28
+ More details can be found in the `documentation <https://pytest-asyncio.readthedocs.io/en/stable/>`_.
29
29
 
30
30
  Note that test classes subclassing the standard `unittest <https://docs.python.org/3/library/unittest.html>`__ library are not supported. Users
31
31
  are advised to use `unittest.IsolatedAsyncioTestCase <https://docs.python.org/3/library/unittest.html#unittest.IsolatedAsyncioTestCase>`__
@@ -0,0 +1,67 @@
1
+ alabaster==1.0.0
2
+ annotated-types-0.7.0
3
+ attrs==26.1.0
4
+ babel==2.18.0
5
+ backports.asyncio.runner==1.2.0
6
+ backports.tarfile==1.2.0
7
+ certifi==2026.4.22
8
+ charset-normalizer==3.4.7
9
+ check-wheel-contents==0.6.3
10
+ cffi==2.0.0
11
+ click==8.4.0
12
+ coverage==7.14.0
13
+ cryptography==48.0.0
14
+ docutils==0.21.2
15
+ exceptiongroup==1.3.1
16
+ hypothesis==6.152.8
17
+ iniconfig==2.3.0
18
+ id==1.6.1
19
+ idna==3.15
20
+ imagesize==2.0.0
21
+ importlib_metadata==9.0.0
22
+ iniconfig==2.3.0
23
+ jaraco.classes==3.4.0
24
+ jaraco.context==6.1.2
25
+ jaraco.functools==4.5.0
26
+ jeepney==0.9.0
27
+ Jinja2==3.1.6
28
+ keyring==25.7.0
29
+ markdown-it-py==4.2.0
30
+ MarkupSafe==3.0.3
31
+ mdurl==0.1.2
32
+ more-itertools==11.0.2
33
+ nh3==0.3.5
34
+ packaging==26.2
35
+ pluggy==1.6.0
36
+ Pygments==2.20.0
37
+ pycparser==3.0
38
+ pydantic==2.13.4
39
+ pydantic-core==2.46.4
40
+ pytest==9.0.3
41
+ readme-renderer==44.0
42
+ requests==2.34.2
43
+ requests-toolbelt==1.0.0
44
+ rfc3986==2.0.0
45
+ rich==15.0.0
46
+ SecretStorage==3.5.0
47
+ setuptools==82.0.1
48
+ setuptools-scm==10.0.5
49
+ snowballstemmer==3.0.1
50
+ sortedcontainers==2.4.0
51
+ Sphinx==8.1.3
52
+ sphinx-tabs==3.5.0
53
+ sphinx-rtd-theme==3.1.0
54
+ sphinxcontrib-applehelp==2.0.0
55
+ sphinxcontrib-devhelp==2.0.0
56
+ sphinxcontrib-htmlhelp==2.1.0
57
+ sphinxcontrib-jquery==4.1
58
+ sphinxcontrib-jsmath==1.0.1
59
+ sphinxcontrib-qthelp==2.0.0
60
+ sphinxcontrib-serializinghtml==2.0.0
61
+ tomli==2.4.1
62
+ twine==6.2.0
63
+ typing_extensions==4.15.0
64
+ typing-inspection==0.4.2
65
+ urllib3==2.7.0
66
+ wheel-filename==1.4.2
67
+ zipp==4.1.0
@@ -14,7 +14,7 @@ packaging==23.2
14
14
  pluggy==1.5.0
15
15
  py==1.11.0
16
16
  Pygments==2.16.1
17
- pytest==8.2.0
17
+ pytest==8.4.0
18
18
  requests==2.31.0
19
19
  sortedcontainers==2.4.0
20
20
  tomli==2.0.1
@@ -1,3 +1,3 @@
1
1
  # Always adjust install_requires in setup.cfg and requirements.txt
2
2
  # when changing minimum version dependencies
3
- pytest[testing] == 8.2.0
3
+ pytest[testing] == 8.4.0
@@ -47,30 +47,50 @@ Assigning neighboring tests to different event loop scopes is discouraged as it
47
47
  Test discovery modes
48
48
  ====================
49
49
 
50
- Pytest-asyncio provides two modes for test discovery, *strict* and *auto*. This can be set through Pytest's ``--asyncio-mode`` command line flag, or through the configuration file:
50
+ Pytest-asyncio provides two modes for test discovery, *strict* and *auto*.
51
+ This can be set through Pytest's ``--asyncio-mode`` command line flag,
52
+ or through the configuration file.
51
53
 
52
- .. code-block:: toml
54
+ .. tabs::
53
55
 
54
- [tool.pytest.ini_options]
55
- asyncio_mode = "auto" # or "strict"
56
+ .. group-tab:: Strict mode
56
57
 
57
- Strict mode
58
- -----------
58
+ .. code-block:: toml
59
59
 
60
- In strict mode pytest-asyncio will only run tests that have the *asyncio* marker and will only evaluate async fixtures decorated with ``@pytest_asyncio.fixture``. Test functions and fixtures without these markers and decorators will not be handled by pytest-asyncio.
60
+ [tool.pytest.ini_options]
61
+ asyncio_mode = "strict"
61
62
 
62
- This mode is intended for projects that want so support multiple asynchronous programming libraries as it allows pytest-asyncio to coexist with other async testing plugins in the same codebase.
63
+ In strict mode pytest-asyncio will only run tests that have the *asyncio* marker
64
+ and will only evaluate async fixtures decorated with ``@pytest_asyncio.fixture``.
65
+ Test functions and fixtures without these markers and decorators will not be
66
+ handled by pytest-asyncio.
63
67
 
64
- Pytest automatically enables installed plugins. As a result pytest plugins need to coexist peacefully in their default configuration. This is why strict mode is the default mode.
68
+ This mode is intended for projects that want to support multiple asynchronous
69
+ programming libraries as it allows pytest-asyncio to coexist with other async
70
+ testing plugins in the same codebase.
65
71
 
66
- Auto mode
67
- ---------
72
+ Pytest automatically enables installed plugins. As a result pytest plugins
73
+ need to coexist peacefully in their default configuration. This is why strict
74
+ mode is the default mode.
68
75
 
69
- In *auto* mode pytest-asyncio automatically adds the *asyncio* marker to all asynchronous test functions. It will also take ownership of all async fixtures, regardless of whether they are decorated with ``@pytest.fixture`` or ``@pytest_asyncio.fixture``.
76
+ .. group-tab:: Auto mode
70
77
 
71
- This mode is intended for projects that use *asyncio* as their only asynchronous programming library. Auto mode makes for the simplest test and fixture configuration and is the recommended default.
78
+ .. code-block:: toml
72
79
 
73
- If you intend to support multiple asynchronous programming libraries, e.g. *asyncio* and *trio*, strict mode will be the preferred option.
80
+ [tool.pytest.ini_options]
81
+ asyncio_mode = "auto"
82
+
83
+ In *auto* mode pytest-asyncio automatically adds the *asyncio* marker to all
84
+ asynchronous test functions. It will also take ownership of all async fixtures,
85
+ regardless of whether they are decorated with ``@pytest.fixture`` or
86
+ ``@pytest_asyncio.fixture``.
87
+
88
+ This mode is intended for projects that use *asyncio* as their only asynchronous
89
+ programming library. Auto mode makes for the simplest test and fixture
90
+ configuration and is the recommended default.
91
+
92
+ If you intend to support multiple asynchronous programming libraries,
93
+ e.g. *asyncio* and *trio*, strict mode will be the preferred option.
74
94
 
75
95
  .. _concepts/concurrent_execution:
76
96
 
@@ -16,7 +16,7 @@ release = importlib.metadata.version(project)
16
16
  # -- General configuration ---------------------------------------------------
17
17
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
18
18
 
19
- extensions = []
19
+ extensions = ["sphinx_tabs.tabs"]
20
20
 
21
21
  templates_path = ["_templates"]
22
22
  exclude_patterns = []
@@ -3,22 +3,27 @@ How to change the default event loop scope of all fixtures
3
3
  ==========================================================
4
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
5
 
6
- .. code-block:: ini
7
- :caption: pytest.ini
6
+ .. tabs::
8
7
 
9
- [pytest]
10
- asyncio_default_fixture_loop_scope = session
8
+ .. tab:: pytest.ini
11
9
 
12
- .. code-block:: toml
13
- :caption: pyproject.toml
10
+ .. code-block:: ini
14
11
 
15
- [tool.pytest.ini_options]
16
- asyncio_default_fixture_loop_scope = "session"
12
+ [pytest]
13
+ asyncio_default_fixture_loop_scope = session
17
14
 
18
- .. code-block:: ini
19
- :caption: setup.cfg
15
+ .. tab:: pyproject.toml
20
16
 
21
- [tool:pytest]
22
- asyncio_default_fixture_loop_scope = session
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
23
28
 
24
29
  Please refer to :ref:`configuration/asyncio_default_fixture_loop_scope` for other valid scopes.
@@ -3,22 +3,28 @@ How to change the default event loop scope of all tests
3
3
  =======================================================
4
4
  The :ref:`configuration/asyncio_default_test_loop_scope` configuration option sets the default event loop scope for asynchronous tests. The following code snippets configure all tests to run in a session-scoped loop by default:
5
5
 
6
- .. code-block:: ini
7
- :caption: pytest.ini
6
+ .. tabs::
8
7
 
9
- [pytest]
10
- asyncio_default_test_loop_scope = session
8
+ .. tab:: pytest.ini
11
9
 
12
- .. code-block:: toml
13
- :caption: pyproject.toml
10
+ .. code-block:: ini
14
11
 
15
- [tool.pytest.ini_options]
16
- asyncio_default_test_loop_scope = "session"
12
+ [pytest]
13
+ asyncio_default_test_loop_scope = session
17
14
 
18
- .. code-block:: ini
19
- :caption: setup.cfg
15
+ .. tab:: pyproject.toml
20
16
 
21
- [tool:pytest]
22
- asyncio_default_test_loop_scope = session
17
+ .. code-block:: toml
23
18
 
24
- Please refer to :ref:`configuration/asyncio_default_test_loop_scope` for other valid scopes.
19
+ [tool.pytest.ini_options]
20
+ asyncio_default_test_loop_scope = "session"
21
+
22
+ .. tab:: setup.cfg
23
+
24
+ .. code-block:: ini
25
+
26
+ [tool:pytest]
27
+ asyncio_default_test_loop_scope = session
28
+
29
+ Please refer to :ref:`configuration/asyncio_default_test_loop_scope`
30
+ for other valid scopes.
@@ -0,0 +1,18 @@
1
+ import asyncio
2
+
3
+ import pytest
4
+
5
+
6
+ class CustomEventLoop(asyncio.SelectorEventLoop):
7
+ pass
8
+
9
+
10
+ @pytest.fixture
11
+ def requires_custom_loop():
12
+ pass
13
+
14
+
15
+ def pytest_asyncio_loop_factories(config, item):
16
+ if "requires_custom_loop" in item.fixturenames:
17
+ return {"custom": CustomEventLoop}
18
+ return {"default": asyncio.new_event_loop}
@@ -0,0 +1,11 @@
1
+ import pytest
2
+
3
+
4
+ @pytest.mark.asyncio
5
+ async def test_runs_with_default_factory_only():
6
+ pass
7
+
8
+
9
+ @pytest.mark.asyncio
10
+ async def test_runs_with_custom_factory_only(requires_custom_loop):
11
+ pass
@@ -0,0 +1,29 @@
1
+ ========================================================
2
+ How to configure event loop factories from the test item
3
+ ========================================================
4
+
5
+ ``pytest_asyncio_loop_factories`` is called with the current pytest ``item``.
6
+ Use that item to decide which named event loop factories are available for the test being collected.
7
+
8
+ For example, a hook can inspect the test's fixtures and return a different factory mapping for tests that request a particular fixture.
9
+ In ``conftest.py``, check the current item's fixture names and build the factory mapping for that item:
10
+
11
+ .. include:: configure_loop_factories_per_test/conftest.py
12
+ :code: python
13
+
14
+ Then request the fixture from tests that should use the custom factory:
15
+
16
+ .. include:: configure_loop_factories_per_test/test_extra_loop_factories.py
17
+ :code: python
18
+
19
+ In this example, ``test_runs_with_default_factory_only`` is parametrized only over ``default``, while ``test_runs_with_custom_factory_only`` is parametrized only over ``custom``.
20
+
21
+ The same pattern works with any information available from the current pytest item, such as fixture names, markers, node IDs, or file paths.
22
+
23
+ Because this is a standard pytest hook, its placement also matters.
24
+ An implementation in a nested ``conftest.py`` applies to tests collected under that directory.
25
+ Use this when a whole package or directory should share the same factory set.
26
+
27
+ For declaring factories without item-specific logic, see :doc:`custom_loop_factory`.
28
+
29
+ For selecting a subset of available factories from a test, see :doc:`run_test_with_specific_loop_factories`.
@@ -0,0 +1,26 @@
1
+ ================================================
2
+ How to use custom event loop factories for tests
3
+ ================================================
4
+
5
+ pytest-asyncio can run asynchronous tests with custom event loop factories by implementing ``pytest_asyncio_loop_factories`` in ``conftest.py``. The hook provides the named event loop factories that are available for a test item by returning a mapping from factory names to loop factory callables:
6
+
7
+ .. code-block:: python
8
+
9
+ import asyncio
10
+
11
+ import pytest
12
+
13
+
14
+ class CustomEventLoop(asyncio.SelectorEventLoop):
15
+ pass
16
+
17
+
18
+ def pytest_asyncio_loop_factories(config, item):
19
+ return {
20
+ "stdlib": asyncio.new_event_loop,
21
+ "custom": CustomEventLoop,
22
+ }
23
+
24
+ The hook receives the current pytest ``item``, so it can return different factory mappings for different tests. See :doc:`configure_loop_factories_per_test` for item-based factory configuration.
25
+
26
+ To run a test with only some configured factories, see :doc:`run_test_with_specific_loop_factories`.
@@ -10,6 +10,9 @@ How-To Guides
10
10
  change_fixture_loop
11
11
  change_default_fixture_loop
12
12
  change_default_test_loop
13
+ custom_loop_factory
14
+ configure_loop_factories_per_test
15
+ run_test_with_specific_loop_factories
13
16
  run_class_tests_in_same_loop
14
17
  run_module_tests_in_same_loop
15
18
  run_package_tests_in_same_loop
@@ -1,3 +1,5 @@
1
+ .. _how_to_guides/migrate_from_0_23:
2
+
1
3
  ========================================
2
4
  How to migrate from pytest-asyncio v0.23
3
5
  ========================================
@@ -2,6 +2,10 @@
2
2
  How to test with different event loops
3
3
  ======================================
4
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
+
5
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:
6
10
 
7
11
  .. include:: multiple_loops_example.py
@@ -0,0 +1,12 @@
1
+ import asyncio
2
+
3
+
4
+ class CustomEventLoop(asyncio.SelectorEventLoop):
5
+ pass
6
+
7
+
8
+ def pytest_asyncio_loop_factories(config, item):
9
+ return {
10
+ "default": asyncio.new_event_loop,
11
+ "custom": CustomEventLoop,
12
+ }
@@ -0,0 +1,11 @@
1
+ import pytest
2
+
3
+
4
+ @pytest.mark.asyncio
5
+ async def test_runs_with_every_configured_factory():
6
+ pass
7
+
8
+
9
+ @pytest.mark.asyncio(loop_factories=["custom"])
10
+ async def test_runs_with_only_custom_factory():
11
+ pass
@@ -0,0 +1,23 @@
1
+ =========================================================
2
+ How to run a test with specific event loop factories only
3
+ =========================================================
4
+
5
+ ``pytest_asyncio_loop_factories`` determines which named event loop factories are available for each test item.
6
+ By default, pytest-asyncio parametrizes a test with every factory returned for that item.
7
+ Use ``loop_factories`` to select a subset of the factory names returned by the hook.
8
+
9
+ Assume ``conftest.py`` provides two named factories:
10
+
11
+ .. include:: run_test_with_specific_loop_factories/conftest.py
12
+ :code: python
13
+
14
+ Then use ``loop_factories`` to select which available factory names a test should run with:
15
+
16
+ .. include:: run_test_with_specific_loop_factories/test_loop_factories_subset.py
17
+ :code: python
18
+
19
+ If a requested factory name is not available from the hook, the test variant for that factory is skipped.
20
+
21
+ For declaring the factories themselves, see :doc:`custom_loop_factory`.
22
+
23
+ For choosing the available factories from the pytest item, see :doc:`configure_loop_factories_per_test`.
@@ -0,0 +1,41 @@
1
+ =======================
2
+ How to test with uvloop
3
+ =======================
4
+
5
+ Define a ``pytest_asyncio_loop_factories`` hook in your *conftest.py* that maps factory names to loop factories:
6
+
7
+ .. code-block:: python
8
+
9
+ import uvloop
10
+
11
+
12
+ def pytest_asyncio_loop_factories(config, item):
13
+ return {
14
+ "uvloop": uvloop.new_event_loop,
15
+ }
16
+
17
+ .. seealso::
18
+
19
+ :doc:`custom_loop_factory`
20
+ More details on the ``pytest_asyncio_loop_factories`` hook, including per-test factory selection and multiple factory parametrization.
21
+
22
+ Using the event_loop_policy fixture
23
+ -----------------------------------
24
+
25
+ .. note::
26
+
27
+ ``asyncio.AbstractEventLoopPolicy`` is deprecated as of Python 3.14 (removal planned for 3.16), and ``uvloop.EventLoopPolicy`` will be removed alongside it. Overriding the *event_loop_policy* fixture is also deprecated in pytest-asyncio. Prefer the hook approach above.
28
+
29
+ For older versions of Python and uvloop, you can override the *event_loop_policy* fixture in your *conftest.py:*
30
+
31
+ .. code-block:: python
32
+
33
+ import pytest
34
+ import uvloop
35
+
36
+
37
+ @pytest.fixture(scope="session")
38
+ def event_loop_policy():
39
+ return uvloop.EventLoopPolicy()
40
+
41
+ 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 uvloop.
@@ -6,10 +6,72 @@ All notable changes to this project will be documented in this file.
6
6
 
7
7
  The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.1.0/>`__, and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`__.
8
8
 
9
- This project uses `towncrier <https://towncrier.readthedocs.io/>`__ for changlog management and the changes for the upcoming release can be found in https://github.com/pytest-dev/pytest-asyncio/tree/main/changelog.d/.
9
+ This project uses `towncrier <https://towncrier.readthedocs.io/>`__ for changelog management and the changes for the upcoming release can be found in https://github.com/pytest-dev/pytest-asyncio/tree/main/changelog.d/.
10
10
 
11
11
  .. towncrier release notes start
12
12
 
13
+ `1.4.0 <https://github.com/pytest-dev/pytest-asyncio/tree/1.4.0>`_ - 2026-05-26
14
+ ===============================================================================
15
+
16
+ Deprecated
17
+ ----------
18
+
19
+ - Overriding the *event_loop_policy* fixture is deprecated. Use the ``pytest_asyncio_loop_factories`` hook instead. (`#1419 <https://github.com/pytest-dev/pytest-asyncio/issues/1419>`_)
20
+
21
+
22
+ Added
23
+ -----
24
+
25
+ - Added the ``pytest_asyncio_loop_factories`` hook to parametrize asyncio tests with custom event loop factories.
26
+
27
+ The hook returns a mapping of factory names to loop factories, and ``pytest.mark.asyncio(loop_factories=[...])`` selects a subset of configured factories per test. When a single factory is configured, test names are unchanged.
28
+
29
+ Synchronous ``@pytest_asyncio.fixture`` functions now see the correct event loop when custom loop factories are configured, even when test code disrupts the current event loop (e.g., via ``asyncio.run()`` or ``asyncio.set_event_loop(None)``). (`#1164 <https://github.com/pytest-dev/pytest-asyncio/issues/1164>`_)
30
+
31
+
32
+ Changed
33
+ -------
34
+
35
+ - Improved the readability of the warning message that is displayed when ``asyncio_default_fixture_loop_scope`` is unset (`#1298 <https://github.com/pytest-dev/pytest-asyncio/issues/1298>`_)
36
+ - Only import ``asyncio.AbstractEventLoopPolicy`` for type checking to avoid raising
37
+ a DeprecationWarning. (`#1394 <https://github.com/pytest-dev/pytest-asyncio/issues/1394>`_)
38
+ - Updated minimum supported pytest version to v8.4.0. (`#1397 <https://github.com/pytest-dev/pytest-asyncio/issues/1397>`_)
39
+
40
+
41
+ Fixed
42
+ -----
43
+
44
+ - Fixed a ``ResourceWarning: unclosed event loop`` warning that could occur when a synchronous test called ``asyncio.run()`` or otherwise unset the current event loop after pytest-asyncio had run an async test or fixture. (`#724 <https://github.com/pytest-dev/pytest-asyncio/issues/724>`_)
45
+
46
+
47
+ Notes for Downstream Packagers
48
+ ------------------------------
49
+
50
+ - Added dependency on ``sphinx-tabs >= 3.5`` to organize documentation examples into tabs. (`#1395 <https://github.com/pytest-dev/pytest-asyncio/issues/1395>`_)
51
+
52
+
53
+ `1.3.0 <https://github.com/pytest-dev/pytest-asyncio/tree/1.3.0>`_ - 2025-11-10
54
+ ===============================================================================
55
+
56
+ Removed
57
+ -------
58
+
59
+ - Support for Python 3.9 (`#1278 <https://github.com/pytest-dev/pytest-asyncio/issues/1278>`_)
60
+
61
+
62
+ Added
63
+ -----
64
+
65
+ - Support for pytest 9 (`#1279 <https://github.com/pytest-dev/pytest-asyncio/issues/1279>`_)
66
+
67
+
68
+ Notes for Downstream Packagers
69
+ ------------------------------
70
+
71
+ - Tested Python versions include free threaded Python 3.14t (`#1274 <https://github.com/pytest-dev/pytest-asyncio/issues/1274>`_)
72
+ - Tests are run in the same pytest process, instead of spawning a subprocess with `pytest.Pytester.runpytest_subprocess`. This prevents the test suite from accidentally using a system installation of pytest-asyncio, which could result in test errors. (`#1275 <https://github.com/pytest-dev/pytest-asyncio/issues/1275>`_)
73
+
74
+
13
75
  `1.2.0 <https://github.com/pytest-dev/pytest-asyncio/tree/1.2.0>`_ - 2025-09-12
14
76
  ===============================================================================
15
77
 
@@ -62,6 +124,10 @@ Notes for Downstream Packagers
62
124
  `1.0.0 <https://github.com/pytest-dev/pytest-asyncio/tree/1.0.0>`_ - 2025-05-26
63
125
  ===============================================================================
64
126
 
127
+ .. seealso::
128
+
129
+ :ref:`How to migrate from pytest-asyncio v0.23 <how_to_guides/migrate_from_0_23>`
130
+
65
131
  Removed
66
132
  -------
67
133
 
@@ -211,6 +277,10 @@ As of v0.23, pytest-asyncio attaches an asyncio event loop to each item of the t
211
277
  This release is backwards-compatible with v0.21.
212
278
  Changes are non-breaking, unless you upgrade from v0.22.
213
279
 
280
+ .. seealso::
281
+
282
+ :ref:`How to migrate from pytest-asyncio v0.21 <how_to_guides/migrate_from_0_21>`
283
+
214
284
  - BREAKING: The *asyncio_event_loop* mark has been removed. Event loops with class, module, package, and session scopes can be requested via the *scope* keyword argument to the _asyncio_ mark.
215
285
  - Introduces the *event_loop_policy* fixture which allows testing with non-default or multiple event loops `#662 <https://github.com/pytest-dev/pytest-asyncio/pull/662>`_
216
286
  - Introduces ``pytest_asyncio.is_async_test`` which returns whether a test item is managed by pytest-asyncio `#376 <https://github.com/pytest-dev/pytest-asyncio/issues/376>`_
@@ -4,6 +4,11 @@ Fixtures
4
4
 
5
5
  event_loop_policy
6
6
  =================
7
+
8
+ .. warning::
9
+
10
+ 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:`../hooks` for details.
11
+
7
12
  Returns the event loop policy used to create asyncio event loops.
8
13
  The default return value is *asyncio.get_event_loop_policy().*
9
14