Skip to content

test: Adapt unmarked async tests in strict mode for pytest 8.4.0 #1141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions tests/modes/test_strict_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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*"])


Expand All @@ -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*",
Expand Down Expand Up @@ -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*",
Expand Down Expand Up @@ -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*",
Expand Down
Loading