11from textwrap import dedent
22
3- pytest_plugins = "pytester"
4-
5-
63LEGACY_MODE = (
74 "The 'asyncio_mode' default value will change to 'strict' in future, "
85 "please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' "
1815).format (name = "*" )
1916
2017
21- def test_warning_for_legacy_mode_cmdline (pytester ):
22- pytester .makepyfile (
18+ def test_warning_for_legacy_mode_cmdline (testdir ):
19+ testdir .makepyfile (
2320 dedent (
2421 """\
2522 import asyncio
@@ -33,13 +30,13 @@ async def test_a():
3330 """
3431 )
3532 )
36- result = pytester .runpytest ("--asyncio-mode=legacy" )
33+ result = testdir .runpytest ("--asyncio-mode=legacy" )
3734 assert result .parseoutcomes ()["warnings" ] == 1
3835 result .stdout .fnmatch_lines (["*" + LEGACY_MODE + "*" ])
3936
4037
41- def test_warning_for_legacy_mode_cfg (pytester ):
42- pytester .makepyfile (
38+ def test_warning_for_legacy_mode_cfg (testdir ):
39+ testdir .makepyfile (
4340 dedent (
4441 """\
4542 import asyncio
@@ -53,15 +50,15 @@ async def test_a():
5350 """
5451 )
5552 )
56- pytester .makefile (".ini" , pytest = "[pytest]\n asyncio_mode = legacy\n " )
57- result = pytester .runpytest ()
53+ testdir .makefile (".ini" , pytest = "[pytest]\n asyncio_mode = legacy\n " )
54+ result = testdir .runpytest ()
5855 assert result .parseoutcomes ()["warnings" ] == 1
5956 result .stdout .fnmatch_lines (["*" + LEGACY_MODE + "*" ])
6057 result .stdout .no_fnmatch_line ("*" + LEGACY_ASYNCIO_FIXTURE + "*" )
6158
6259
63- def test_warning_for_legacy_fixture (pytester ):
64- pytester .makepyfile (
60+ def test_warning_for_legacy_fixture (testdir ):
61+ testdir .makepyfile (
6562 dedent (
6663 """\
6764 import asyncio
@@ -81,13 +78,13 @@ async def test_a(fixture_a):
8178 """
8279 )
8380 )
84- result = pytester .runpytest ("--asyncio-mode=legacy" )
81+ result = testdir .runpytest ("--asyncio-mode=legacy" )
8582 assert result .parseoutcomes ()["warnings" ] == 2
8683 result .stdout .fnmatch_lines (["*" + LEGACY_ASYNCIO_FIXTURE + "*" ])
8784
8885
89- def test_warning_for_legacy_method_fixture (pytester ):
90- pytester .makepyfile (
86+ def test_warning_for_legacy_method_fixture (testdir ):
87+ testdir .makepyfile (
9188 dedent (
9289 """\
9390 import asyncio
@@ -110,6 +107,6 @@ async def test_a(self, fixture_a):
110107 """
111108 )
112109 )
113- result = pytester .runpytest ("--asyncio-mode=legacy" )
110+ result = testdir .runpytest ("--asyncio-mode=legacy" )
114111 assert result .parseoutcomes ()["warnings" ] == 2
115112 result .stdout .fnmatch_lines (["*" + LEGACY_ASYNCIO_FIXTURE + "*" ])
0 commit comments