diff --git a/tests/test_pytest_skip.py b/tests/test_pytest_skip.py new file mode 100644 index 00000000..3c669cfb --- /dev/null +++ b/tests/test_pytest_skip.py @@ -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) diff --git a/tests/test_simple.py b/tests/test_simple.py index c448de92..05c92694 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -100,41 +100,6 @@ async def test_event_loop_before_fixture(self, loop): assert await loop.run_in_executor(None, self.foo) == 1 -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) - - def test_invalid_asyncio_mode(testdir): result = testdir.runpytest("-o", "asyncio_mode=True") result.stderr.no_fnmatch_line("INTERNALERROR> *")