Skip to content

Commit 596e5a8

Browse files
committed
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 <ziyao@disroot.org>
1 parent 5cedab6 commit 596e5a8

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

tests/modes/test_strict_mode.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from textwrap import dedent
44

5-
from pytest import Pytester
5+
from pytest import Pytester, version_tuple as pytest_version
66

77

88
def test_strict_mode_cmdline(pytester: Pytester):
@@ -95,7 +95,10 @@ async def test_anything():
9595
)
9696
)
9797
result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default")
98-
result.assert_outcomes(skipped=1, warnings=1)
98+
if pytest_version >= (8, 4, 0):
99+
result.assert_outcomes(failed=1, skipped=0, warnings=0)
100+
else:
101+
result.assert_outcomes(skipped=1, warnings=1)
99102
result.stdout.fnmatch_lines(["*async def functions are not natively supported*"])
100103

101104

@@ -117,7 +120,11 @@ async def test_anything(any_fixture):
117120
)
118121
)
119122
result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default")
120-
result.assert_outcomes(skipped=1, warnings=2)
123+
124+
if pytest_version >= (8, 4, 0):
125+
result.assert_outcomes(failed=1, skipped=0, warnings=2)
126+
else:
127+
result.assert_outcomes(skipped=1, warnings=2)
121128
result.stdout.fnmatch_lines(
122129
[
123130
"*async def functions are not natively supported*",
@@ -149,7 +156,10 @@ async def test_anything(any_fixture):
149156
)
150157
)
151158
result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default")
152-
result.assert_outcomes(passed=1, failed=0, skipped=0, warnings=1)
159+
if pytest_version >= (8, 4, 0):
160+
result.assert_outcomes(passed=1, failed=0, skipped=0, warnings=2)
161+
else:
162+
result.assert_outcomes(passed=1, failed=0, skipped=0, warnings=1)
153163
result.stdout.fnmatch_lines(
154164
[
155165
"*warnings summary*",
@@ -193,7 +203,10 @@ async def test_anything(any_fixture):
193203
)
194204
)
195205
result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default")
196-
result.assert_outcomes(passed=1, warnings=1)
206+
if pytest_version >= (8, 4, 0):
207+
result.assert_outcomes(passed=1, warnings=2)
208+
else:
209+
result.assert_outcomes(passed=1, warnings=1)
197210
result.stdout.fnmatch_lines(
198211
[
199212
"*warnings summary*",

0 commit comments

Comments
 (0)