File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 4
4
import pytest
5
5
6
6
7
+ def test_simple_params (ctestdir ):
8
+ """Simple test for a dependency on a parametrized test.
9
+
10
+ This example has been used in the discussion of PR #43.
11
+ """
12
+ ctestdir .makepyfile ("""
13
+ import pytest
14
+
15
+ _md = pytest.mark.dependency
16
+
17
+ @pytest.mark.parametrize("x", [ 0, 1 ])
18
+ @pytest.mark.dependency()
19
+ def test_a(x):
20
+ assert x == 0
21
+
22
+ @pytest.mark.parametrize("x", [
23
+ pytest.param(0, marks=_md(depends=["test_a[0]"])),
24
+ pytest.param(1, marks=_md(depends=["test_a[1]"])),
25
+ ])
26
+ def test_b(x):
27
+ pass
28
+ """ )
29
+ result = ctestdir .runpytest ("--verbose" )
30
+ result .assert_outcomes (passed = 2 , skipped = 1 , failed = 1 )
31
+ result .stdout .re_match_lines (r"""
32
+ .*::test_a\[0\] PASSED
33
+ .*::test_a\[1\] FAILED
34
+ .*::test_b\[0\] PASSED
35
+ .*::test_b\[1\] SKIPPED(?:\s+\(.*\))?
36
+ """ )
37
+
38
+
7
39
def test_multiple (ctestdir ):
8
40
ctestdir .makepyfile ("""
9
41
import pytest
You can’t perform that action at this time.
0 commit comments