Skip to content

Commit b68f602

Browse files
committed
Add a test to #11.
1 parent 2757a57 commit b68f602

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/test_03_skipmsgs.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""Verify the messages issued when a dependent test is skipped.
2+
"""
3+
4+
import pytest
5+
6+
7+
def test_simple(ctestdir):
8+
"""One test fails, other dependent tests are skipped.
9+
This also includes indirect dependencies.
10+
"""
11+
ctestdir.makepyfile("""
12+
import pytest
13+
14+
@pytest.mark.dependency()
15+
def test_a():
16+
pass
17+
18+
@pytest.mark.dependency()
19+
def test_b():
20+
assert False
21+
22+
@pytest.mark.dependency(depends=["test_b"])
23+
def test_c():
24+
pass
25+
26+
@pytest.mark.dependency(depends=["test_c"])
27+
def test_d():
28+
pass
29+
""")
30+
result = ctestdir.runpytest("--verbose", "-rs")
31+
result.assert_outcomes(passed=1, skipped=2, failed=1)
32+
result.stdout.fnmatch_lines("""
33+
*::test_a PASSED
34+
*::test_b FAILED
35+
*::test_c SKIPPED
36+
*::test_d SKIPPED
37+
SKIP * test_c depends on test_b
38+
SKIP * test_d depends on test_c
39+
""")

0 commit comments

Comments
 (0)