-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] Extracted test for pytest.skip into a separate test module.
This prevents unrelated tests from aggregating in test_simple.py. Signed-off-by: Michael Seifert <[email protected]>
- Loading branch information
Showing
2 changed files
with
38 additions
and
35 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,38 @@ | ||
from textwrap import dedent | ||
|
||
from pytest import Pytester | ||
|
||
|
||
def test_asyncio_marker_compatibility_with_skip(pytester: Pytester): | ||
pytester.makepyfile( | ||
dedent( | ||
"""\ | ||
import pytest | ||
pytest_plugins = "pytest_asyncio" | ||
@pytest.mark.asyncio | ||
async def test_no_warning_on_skip(): | ||
pytest.skip("Test a skip error inside asyncio") | ||
""" | ||
) | ||
) | ||
result = pytester.runpytest("--asyncio-mode=strict") | ||
result.assert_outcomes(skipped=1) | ||
|
||
|
||
def test_asyncio_auto_mode_compatibility_with_skip(pytester: Pytester): | ||
pytester.makepyfile( | ||
dedent( | ||
"""\ | ||
import pytest | ||
pytest_plugins = "pytest_asyncio" | ||
async def test_no_warning_on_skip(): | ||
pytest.skip("Test a skip error inside asyncio") | ||
""" | ||
) | ||
) | ||
result = pytester.runpytest("--asyncio-mode=auto") | ||
result.assert_outcomes(skipped=1) |
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