Skip to content

Commit d697a12

Browse files
committed
[refactor] test_warn_asyncio_marker_for_regular_func uses pytester, instead of the older "testdir" fixture.
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
1 parent 5a474bd commit d697a12

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/test_asyncio_mark_on_sync_function.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from textwrap import dedent
22

3+
from pytest import Pytester
34

4-
def test_warn_asyncio_marker_for_regular_func(testdir):
5-
testdir.makepyfile(
5+
6+
def test_warn_asyncio_marker_for_regular_func(pytester: Pytester):
7+
pytester.makepyfile(
68
dedent(
79
"""\
810
import pytest
@@ -15,7 +17,7 @@ def test_a():
1517
"""
1618
)
1719
)
18-
testdir.makefile(
20+
pytester.makefile(
1921
".ini",
2022
pytest=dedent(
2123
"""\
@@ -26,7 +28,7 @@ def test_a():
2628
"""
2729
),
2830
)
29-
result = testdir.runpytest()
31+
result = pytester.runpytest()
3032
result.assert_outcomes(passed=1)
3133
result.stdout.fnmatch_lines(
3234
["*is marked with '@pytest.mark.asyncio' but it is not an async function.*"]

0 commit comments

Comments
 (0)