3
3
from pytest import Pytester
4
4
5
5
6
- def test_asyncio_marker_compatibility_with_skip (pytester : Pytester ):
6
+ def test_asyncio_strict_mode_skip (pytester : Pytester ):
7
7
pytester .makepyfile (
8
8
dedent (
9
9
"""\
@@ -21,7 +21,7 @@ async def test_no_warning_on_skip():
21
21
result .assert_outcomes (skipped = 1 )
22
22
23
23
24
- def test_asyncio_auto_mode_compatibility_with_skip (pytester : Pytester ):
24
+ def test_asyncio_auto_mode_skip (pytester : Pytester ):
25
25
pytester .makepyfile (
26
26
dedent (
27
27
"""\
@@ -36,3 +36,55 @@ async def test_no_warning_on_skip():
36
36
)
37
37
result = pytester .runpytest ("--asyncio-mode=auto" )
38
38
result .assert_outcomes (skipped = 1 )
39
+
40
+
41
+ def test_asyncio_strict_mode_module_level_skip (pytester : Pytester ):
42
+ pytester .makepyfile (
43
+ dedent (
44
+ """\
45
+ import pytest
46
+
47
+ pytest.skip("Skip all tests", allow_module_level=True)
48
+
49
+ @pytest.mark.asyncio
50
+ async def test_is_skipped():
51
+ pass
52
+ """
53
+ )
54
+ )
55
+ result = pytester .runpytest ("--asyncio-mode=strict" )
56
+ result .assert_outcomes (skipped = 1 )
57
+
58
+
59
+ def test_asyncio_auto_mode_module_level_skip (pytester : Pytester ):
60
+ pytester .makepyfile (
61
+ dedent (
62
+ """\
63
+ import pytest
64
+
65
+ pytest.skip("Skip all tests", allow_module_level=True)
66
+
67
+ async def test_is_skipped():
68
+ pass
69
+ """
70
+ )
71
+ )
72
+ result = pytester .runpytest ("--asyncio-mode=auto" )
73
+ result .assert_outcomes (skipped = 1 )
74
+
75
+
76
+ def test_asyncio_auto_mode_wrong_skip_usage (pytester : Pytester ):
77
+ pytester .makepyfile (
78
+ dedent (
79
+ """\
80
+ import pytest
81
+
82
+ pytest.skip("Skip all tests")
83
+
84
+ async def test_is_skipped():
85
+ pass
86
+ """
87
+ )
88
+ )
89
+ result = pytester .runpytest ("--asyncio-mode=auto" )
90
+ result .assert_outcomes (errors = 1 )
0 commit comments