From 79b2d1aed3d31e0f95e7d97e6176ff6b82f62635 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Wed, 12 Jul 2023 11:01:23 +0200 Subject: [PATCH] [test] Added a test case which verifies compatibility with pytest.skip in auto mode. Signed-off-by: Michael Seifert --- docs/source/reference/changelog.rst | 1 + tests/test_simple.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/docs/source/reference/changelog.rst b/docs/source/reference/changelog.rst index 00b73fa0..f68a63c2 100644 --- a/docs/source/reference/changelog.rst +++ b/docs/source/reference/changelog.rst @@ -7,6 +7,7 @@ Changelog - Output a proper error message when an invalid ``asyncio_mode`` is selected. - Extend warning message about unclosed event loops with additional possible cause. `#531 `_ +- Previously, some tests reported "skipped" or "xfailed" as a result. Now all tests report a "success" results. 0.21.0 (2023-03-19) =================== diff --git a/tests/test_simple.py b/tests/test_simple.py index c9853557..facb1cfc 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -283,6 +283,23 @@ async def test_no_warning_on_skip(): 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_async_close_loop(event_loop): event_loop.close()