From c9b0864e423f983bbe090777232b0ebb5d938faff0af0156c7e2faf2bb7915b5 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 23 Jun 2025 05:46:05 +0000 Subject: [PATCH] - Add upstream pytest84.patch for compatibility with pytest 8.4.0 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-asyncio?expand=0&rev=57 --- pytest84.patch | 78 +++++++++++++++++++++++++++++++++++ python-pytest-asyncio.changes | 5 +++ python-pytest-asyncio.spec | 2 + 3 files changed, 85 insertions(+) create mode 100644 pytest84.patch diff --git a/pytest84.patch b/pytest84.patch new file mode 100644 index 0000000..1beb6f5 --- /dev/null +++ b/pytest84.patch @@ -0,0 +1,78 @@ +From 8c6612fda96f78a1df2f0d271426b7b6e3c10737 Mon Sep 17 00:00:00 2001 +From: Yao Zi +Date: Tue, 10 Jun 2025 16:17:11 +0000 +Subject: [PATCH] test: Adapt unmarked async tests in strict mode for pytest + 8.4.0 + +Async tests fail instead of skipping and warning with Pytest 8.4.0 if +no suitable async plugin is installed[1]. Adjust expectation of these +tests to pass the testsuite with Pytest 8.4.0. + +Link: https://docs.pytest.org/en/stable/changelog.html#pytest-8-4-0-2025-06-02 # [1] +Signed-off-by: Yao Zi +--- + tests/modes/test_strict_mode.py | 23 ++++++++++++++++++----- + 1 file changed, 18 insertions(+), 5 deletions(-) + +diff --git a/tests/modes/test_strict_mode.py b/tests/modes/test_strict_mode.py +index 52cbb251..44f54b7d 100644 +--- a/tests/modes/test_strict_mode.py ++++ b/tests/modes/test_strict_mode.py +@@ -2,7 +2,7 @@ + + from textwrap import dedent + +-from pytest import Pytester ++from pytest import Pytester, version_tuple as pytest_version + + + def test_strict_mode_cmdline(pytester: Pytester): +@@ -95,7 +95,10 @@ async def test_anything(): + ) + ) + result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") +- result.assert_outcomes(skipped=1, warnings=1) ++ if pytest_version >= (8, 4, 0): ++ result.assert_outcomes(failed=1, skipped=0, warnings=0) ++ else: ++ result.assert_outcomes(skipped=1, warnings=1) + result.stdout.fnmatch_lines(["*async def functions are not natively supported*"]) + + +@@ -117,7 +120,11 @@ async def test_anything(any_fixture): + ) + ) + result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") +- result.assert_outcomes(skipped=1, warnings=2) ++ ++ if pytest_version >= (8, 4, 0): ++ result.assert_outcomes(failed=1, skipped=0, warnings=2) ++ else: ++ result.assert_outcomes(skipped=1, warnings=2) + result.stdout.fnmatch_lines( + [ + "*async def functions are not natively supported*", +@@ -149,7 +156,10 @@ async def test_anything(any_fixture): + ) + ) + result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") +- result.assert_outcomes(passed=1, failed=0, skipped=0, warnings=1) ++ if pytest_version >= (8, 4, 0): ++ result.assert_outcomes(passed=1, failed=0, skipped=0, warnings=2) ++ else: ++ result.assert_outcomes(passed=1, failed=0, skipped=0, warnings=1) + result.stdout.fnmatch_lines( + [ + "*warnings summary*", +@@ -193,7 +203,10 @@ async def test_anything(any_fixture): + ) + ) + result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") +- result.assert_outcomes(passed=1, warnings=1) ++ if pytest_version >= (8, 4, 0): ++ result.assert_outcomes(passed=1, warnings=2) ++ else: ++ result.assert_outcomes(passed=1, warnings=1) + result.stdout.fnmatch_lines( + [ + "*warnings summary*", diff --git a/python-pytest-asyncio.changes b/python-pytest-asyncio.changes index b8084d2..1a08732 100644 --- a/python-pytest-asyncio.changes +++ b/python-pytest-asyncio.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Jun 20 12:27:13 UTC 2025 - Markéta Machová + +- Add upstream pytest84.patch for compatibility with pytest 8.4.0 + ------------------------------------------------------------------- Tue May 27 11:12:52 UTC 2025 - Johannes Kastl diff --git a/python-pytest-asyncio.spec b/python-pytest-asyncio.spec index 2f02989..592c154 100644 --- a/python-pytest-asyncio.spec +++ b/python-pytest-asyncio.spec @@ -32,6 +32,8 @@ Summary: Pytest support for asyncio License: Apache-2.0 URL: https://github.com/pytest-dev/pytest-asyncio Source: https://github.com/pytest-dev/pytest-asyncio/archive/v%{version}.tar.gz#/pytest-asyncio-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/pytest-dev/pytest-asyncio/commit/8c6612fda96f78a1df2f0d271426b7b6e3c10737 test: Adapt unmarked async tests in strict mode for pytest 8.4.0 +Patch0: pytest84.patch BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools_scm}