Skip to content

Commit a26b6dd

Browse files
committed
[test] Added a test case which verifies compatibility with pytest.mark.xfail in auto mode.
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
1 parent 7fa36f2 commit a26b6dd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_simple.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ async def test_asyncio_marker_fail():
4545
result.assert_outcomes(xfailed=1)
4646

4747

48+
def test_asyncio_auto_mode_compatibility_with_xfail(pytester: Pytester):
49+
pytester.makepyfile(
50+
dedent(
51+
"""\
52+
import pytest
53+
54+
pytest_plugins = "pytest_asyncio"
55+
56+
@pytest.mark.xfail(reason="need a failure", strict=True)
57+
async def test_asyncio_marker_fail():
58+
raise AssertionError
59+
"""
60+
)
61+
)
62+
result = pytester.runpytest("--asyncio-mode=auto")
63+
result.assert_outcomes(xfailed=1)
64+
65+
4866
@pytest.mark.asyncio
4967
async def test_asyncio_marker_with_default_param(a_param=None):
5068
"""Test the asyncio pytest marker."""

0 commit comments

Comments
 (0)