22
33from textwrap import dedent
44
5- from pytest import Pytester
5+ from pytest import Pytester , version_tuple as pytest_version
66
77
88def 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