From 3995ef091912b7fdb0a73d57b569a9984494647a Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Tue, 31 Oct 2023 14:17:59 +0100 Subject: [PATCH 1/3] [build] Fixes a bug that prevented the pytest-min tox environment from correctly using the minimum pytest version. The "deps" option does not specify the package dependencies, but a list of packages that should be installed before the package under test. However, it's possible ot use "install_command" to specify a constraints file. see https://github.com/tox-dev/tox/issues/1939#issuecomment-814851730 Signed-off-by: Michael Seifert --- tox.ini | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tox.ini b/tox.ini index 33e0c931..5acc30e2 100644 --- a/tox.ini +++ b/tox.ini @@ -7,18 +7,20 @@ passenv = [testenv] extras = testing -deps = - --requirement dependencies/default/requirements.txt - --constraint dependencies/default/constraints.txt +install_command = python -m pip install \ + --requirement dependencies/default/requirements.txt \ + --constraint dependencies/default/constraints.txt \ + {opts} {packages} commands = make test allowlist_externals = make [testenv:pytest-min] extras = testing -deps = - --requirement dependencies/pytest-min/requirements.txt - --constraint dependencies/pytest-min/constraints.txt +install_command = python -m pip install \ + --requirement dependencies/pytest-min/requirements.txt \ + --constraint dependencies/pytest-min/constraints.txt \ + {opts} {packages} commands = make test allowlist_externals = make From f4c08fa00ab1cf2c4a26bf9913f162b53414d7e1 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Tue, 31 Oct 2023 14:47:41 +0100 Subject: [PATCH 2/3] [fix] Fixes a bug that broke compatibility with pytest>=7.0,<7.2. The "consider_mro" keyword argument to _pytest.mark.structures.get_unpacked_marks was only introduced in pytest-7.2.0. Removing the explicit argument from the function call will adjust the behavior of pytest-asyncio marks to that of pytest. Signed-off-by: Michael Seifert --- docs/source/reference/changelog.rst | 4 ++++ pytest_asyncio/plugin.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/source/reference/changelog.rst b/docs/source/reference/changelog.rst index a528c07e..985580e8 100644 --- a/docs/source/reference/changelog.rst +++ b/docs/source/reference/changelog.rst @@ -2,6 +2,10 @@ Changelog ========= +0.22.1 (UNRELEASED) +=================== +- Fixes a bug that broke compatibility with pytest>=7.0,<7.2. `#654 `_ + 0.22.0 (2023-10-31) =================== - Class-scoped and module-scoped event loops can be requested diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 18c86869..b39a47b8 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -549,7 +549,7 @@ def pytest_collectstart(collector: pytest.Collector): return # pytest.Collector.own_markers is empty at this point, # so we rely on _pytest.mark.structures.get_unpacked_marks - marks = get_unpacked_marks(collector.obj, consider_mro=True) + marks = get_unpacked_marks(collector.obj) for mark in marks: if not mark.name == "asyncio_event_loop": continue From 6ffee1c2df978ce4628c3b4d7c1459ce193d013e Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Tue, 31 Oct 2023 15:50:11 +0100 Subject: [PATCH 3/3] [test] Pin trio to v0.21 in the pytest-min test environment to avoid unhandled deprecation warnings. Signed-off-by: Michael Seifert --- dependencies/pytest-min/constraints.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dependencies/pytest-min/constraints.txt b/dependencies/pytest-min/constraints.txt index 1f82dbaf..3cdda3a6 100644 --- a/dependencies/pytest-min/constraints.txt +++ b/dependencies/pytest-min/constraints.txt @@ -18,5 +18,6 @@ pytest==7.0.0 requests==2.28.1 sortedcontainers==2.4.0 tomli==2.0.1 +trio==0.21.0 urllib3==1.26.12 xmlschema==2.1.1