11from textwrap import dedent
22
3+ from pytest import Pytester
34
4- def test_auto_mode_cmdline (testdir ):
5- testdir .makepyfile (
5+
6+ def test_auto_mode_cmdline (pytester : Pytester ):
7+ pytester .makepyfile (
68 dedent (
79 """\
810 import asyncio
@@ -15,12 +17,12 @@ async def test_a():
1517 """
1618 )
1719 )
18- result = testdir .runpytest ("--asyncio-mode=auto" )
20+ result = pytester .runpytest ("--asyncio-mode=auto" )
1921 result .assert_outcomes (passed = 1 )
2022
2123
22- def test_auto_mode_cfg (testdir ):
23- testdir .makepyfile (
24+ def test_auto_mode_cfg (pytester : Pytester ):
25+ pytester .makepyfile (
2426 dedent (
2527 """\
2628 import asyncio
@@ -33,13 +35,13 @@ async def test_a():
3335 """
3436 )
3537 )
36- testdir .makefile (".ini" , pytest = "[pytest]\n asyncio_mode = auto\n " )
37- result = testdir .runpytest ()
38+ pytester .makefile (".ini" , pytest = "[pytest]\n asyncio_mode = auto\n " )
39+ result = pytester .runpytest ()
3840 result .assert_outcomes (passed = 1 )
3941
4042
41- def test_auto_mode_async_fixture (testdir ):
42- testdir .makepyfile (
43+ def test_auto_mode_async_fixture (pytester : Pytester ):
44+ pytester .makepyfile (
4345 dedent (
4446 """\
4547 import asyncio
@@ -58,12 +60,12 @@ async def test_a(fixture_a):
5860 """
5961 )
6062 )
61- result = testdir .runpytest ("--asyncio-mode=auto" )
63+ result = pytester .runpytest ("--asyncio-mode=auto" )
6264 result .assert_outcomes (passed = 1 )
6365
6466
65- def test_auto_mode_method_fixture (testdir ):
66- testdir .makepyfile (
67+ def test_auto_mode_method_fixture (pytester : Pytester ):
68+ pytester .makepyfile (
6769 dedent (
6870 """\
6971 import asyncio
@@ -85,12 +87,12 @@ async def test_a(self, fixture_a):
8587 """
8688 )
8789 )
88- result = testdir .runpytest ("--asyncio-mode=auto" )
90+ result = pytester .runpytest ("--asyncio-mode=auto" )
8991 result .assert_outcomes (passed = 1 )
9092
9193
92- def test_auto_mode_static_method (testdir ):
93- testdir .makepyfile (
94+ def test_auto_mode_static_method (pytester : Pytester ):
95+ pytester .makepyfile (
9496 dedent (
9597 """\
9698 import asyncio
@@ -106,12 +108,12 @@ async def test_a():
106108 """
107109 )
108110 )
109- result = testdir .runpytest ("--asyncio-mode=auto" )
111+ result = pytester .runpytest ("--asyncio-mode=auto" )
110112 result .assert_outcomes (passed = 1 )
111113
112114
113- def test_auto_mode_static_method_fixture (testdir ):
114- testdir .makepyfile (
115+ def test_auto_mode_static_method_fixture (pytester : Pytester ):
116+ pytester .makepyfile (
115117 dedent (
116118 """\
117119 import asyncio
@@ -135,5 +137,5 @@ async def test_a(fixture_a):
135137 """
136138 )
137139 )
138- result = testdir .runpytest ("--asyncio-mode=auto" )
140+ result = pytester .runpytest ("--asyncio-mode=auto" )
139141 result .assert_outcomes (passed = 1 )
0 commit comments