-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] Moved test for warning generated when sync functions are m…
…arked with "asyncio" into a separate test module. The "test_simple" module is named too general. Thus, it serves as a magnet for all kinds of tests that aren't connected to each other. This is one step to break up the "test_simple" module into more coherent test modules. Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
- Loading branch information
Showing
2 changed files
with
33 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from textwrap import dedent | ||
|
||
|
||
def test_warn_asyncio_marker_for_regular_func(testdir): | ||
testdir.makepyfile( | ||
dedent( | ||
"""\ | ||
import pytest | ||
pytest_plugins = 'pytest_asyncio' | ||
@pytest.mark.asyncio | ||
def test_a(): | ||
pass | ||
""" | ||
) | ||
) | ||
testdir.makefile( | ||
".ini", | ||
pytest=dedent( | ||
"""\ | ||
[pytest] | ||
asyncio_mode = strict | ||
filterwarnings = | ||
default | ||
""" | ||
), | ||
) | ||
result = testdir.runpytest() | ||
result.assert_outcomes(passed=1) | ||
result.stdout.fnmatch_lines( | ||
["*is marked with '@pytest.mark.asyncio' but it is not an async function.*"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters