Skip to content

Commit

Permalink
[refactor] test_warn_asyncio_marker_for_regular_func uses pytester, i…
Browse files Browse the repository at this point in the history
…nstead of the older "testdir" fixture.

Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
  • Loading branch information
seifertm committed Oct 24, 2023
1 parent 5a474bd commit d697a12
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_asyncio_mark_on_sync_function.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from textwrap import dedent

from pytest import Pytester

def test_warn_asyncio_marker_for_regular_func(testdir):
testdir.makepyfile(

def test_warn_asyncio_marker_for_regular_func(pytester: Pytester):
pytester.makepyfile(
dedent(
"""\
import pytest
Expand All @@ -15,7 +17,7 @@ def test_a():
"""
)
)
testdir.makefile(
pytester.makefile(
".ini",
pytest=dedent(
"""\
Expand All @@ -26,7 +28,7 @@ def test_a():
"""
),
)
result = testdir.runpytest()
result = pytester.runpytest()
result.assert_outcomes(passed=1)
result.stdout.fnmatch_lines(
["*is marked with '@pytest.mark.asyncio' but it is not an async function.*"]
Expand Down

0 comments on commit d697a12

Please sign in to comment.