1
1
"""Test feature base dir."""
2
+ import pkg_resources
2
3
import pytest
3
4
4
5
NOT_EXISTING_FEATURE_PATHS = ["." , "/does/not/exist/" ]
5
6
7
+ assert_outcomes_extra = pkg_resources .get_distribution ("pytest" ).parsed_version >= pkg_resources .parse_version ("7.0.0" )
8
+
6
9
7
10
@pytest .mark .parametrize ("base_dir" , NOT_EXISTING_FEATURE_PATHS )
8
11
def test_feature_path_not_found (testdir , base_dir ):
9
12
"""Test feature base dir."""
10
13
prepare_testdir (testdir , base_dir )
11
14
12
15
result = testdir .runpytest ("-k" , "test_not_found_by_ini" )
13
- result .assert_outcomes (passed = 2 )
16
+ if assert_outcomes_extra :
17
+ result .assert_outcomes (passed = 2 , deselected = 8 )
18
+ else :
19
+ result .assert_outcomes (passed = 2 )
14
20
15
21
16
22
def test_feature_path_ok (testdir ):
17
23
base_dir = "features"
18
24
prepare_testdir (testdir , base_dir )
19
25
20
26
result = testdir .runpytest ("-k" , "test_ok_by_ini" )
21
- result .assert_outcomes (passed = 2 )
27
+ if assert_outcomes_extra :
28
+ result .assert_outcomes (passed = 2 , deselected = 8 )
29
+ else :
30
+ result .assert_outcomes (passed = 2 )
22
31
23
32
24
33
def test_feature_path_by_param_not_found (testdir ):
@@ -28,7 +37,10 @@ def test_feature_path_by_param_not_found(testdir):
28
37
prepare_testdir (testdir , base_dir )
29
38
30
39
result = testdir .runpytest ("-k" , "test_not_found_by_param" )
31
- result .assert_outcomes (passed = 4 )
40
+ if assert_outcomes_extra :
41
+ result .assert_outcomes (passed = 4 , deselected = 6 )
42
+ else :
43
+ result .assert_outcomes (passed = 4 )
32
44
33
45
34
46
@pytest .mark .parametrize ("base_dir" , NOT_EXISTING_FEATURE_PATHS )
@@ -38,7 +50,10 @@ def test_feature_path_by_param_ok(testdir, base_dir):
38
50
prepare_testdir (testdir , base_dir )
39
51
40
52
result = testdir .runpytest ("-k" , "test_ok_by_param" )
41
- result .assert_outcomes (passed = 2 )
53
+ if assert_outcomes_extra :
54
+ result .assert_outcomes (passed = 2 , deselected = 8 )
55
+ else :
56
+ result .assert_outcomes (passed = 2 )
42
57
43
58
44
59
def prepare_testdir (testdir , ini_base_dir ):
0 commit comments