File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 33from textwrap import dedent
44
55import pytest
6+ from pytest import Pytester
67
78import pytest_asyncio .plugin
89
@@ -25,10 +26,23 @@ async def test_asyncio_marker():
2526 await asyncio .sleep (0 )
2627
2728
28- @pytest .mark .xfail (reason = "need a failure" , strict = True )
29- @pytest .mark .asyncio
30- async def test_asyncio_marker_fail ():
31- raise AssertionError
29+ def test_asyncio_marker_compatibility_with_xfail (pytester : Pytester ):
30+ pytester .makepyfile (
31+ dedent (
32+ """\
33+ import pytest
34+
35+ pytest_plugins = "pytest_asyncio"
36+
37+ @pytest.mark.xfail(reason="need a failure", strict=True)
38+ @pytest.mark.asyncio
39+ async def test_asyncio_marker_fail():
40+ raise AssertionError
41+ """
42+ )
43+ )
44+ result = pytester .runpytest ("--asyncio-mode=strict" )
45+ result .assert_outcomes (xfailed = 1 )
3246
3347
3448@pytest .mark .asyncio
You can’t perform that action at this time.
0 commit comments