Skip to content

Commit 79b2d1a

Browse files
committed
[test] Added a test case which verifies compatibility with pytest.skip in auto mode.
Signed-off-by: Michael Seifert <[email protected]>
1 parent 39a9754 commit 79b2d1a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Diff for: docs/source/reference/changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Changelog
77
- Output a proper error message when an invalid ``asyncio_mode`` is selected.
88
- Extend warning message about unclosed event loops with additional possible cause.
99
`#531 <https://github.com/pytest-dev/pytest-asyncio/issues/531>`_
10+
- Previously, some tests reported "skipped" or "xfailed" as a result. Now all tests report a "success" results.
1011

1112
0.21.0 (2023-03-19)
1213
===================

Diff for: tests/test_simple.py

+17
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,23 @@ async def test_no_warning_on_skip():
283283
result.assert_outcomes(skipped=1)
284284

285285

286+
def test_asyncio_auto_mode_compatibility_with_skip(pytester: Pytester):
287+
pytester.makepyfile(
288+
dedent(
289+
"""\
290+
import pytest
291+
292+
pytest_plugins = "pytest_asyncio"
293+
294+
async def test_no_warning_on_skip():
295+
pytest.skip("Test a skip error inside asyncio")
296+
"""
297+
)
298+
)
299+
result = pytester.runpytest("--asyncio-mode=auto")
300+
result.assert_outcomes(skipped=1)
301+
302+
286303
def test_async_close_loop(event_loop):
287304
event_loop.close()
288305

0 commit comments

Comments
 (0)