8
8
import yaml
9
9
10
10
11
- def _ci_patterns () -> set [str ]:
11
+ def _ci_patterns (repository_root : Path ) -> set [str ]:
12
12
"""
13
13
Return the CI patterns given in the CI configuration file.
14
14
"""
15
- repository_root = Path (__file__ ).parent .parent
16
15
ci_file = repository_root / ".github" / "workflows" / "ci.yml"
17
16
github_workflow_config = yaml .safe_load (ci_file .read_text ())
18
17
matrix = github_workflow_config ["jobs" ]["build" ]["strategy" ]["matrix" ]
@@ -50,12 +49,12 @@ def _tests_from_pattern(
50
49
return tests
51
50
52
51
53
- def test_ci_patterns_valid () -> None :
52
+ def test_ci_patterns_valid (request : pytest . FixtureRequest ) -> None :
54
53
"""
55
54
All of the CI patterns in the CI configuration match at least one test in
56
55
the test suite.
57
56
"""
58
- ci_patterns = _ci_patterns ()
57
+ ci_patterns = _ci_patterns (repository_root = request . config . rootpath )
59
58
60
59
for ci_pattern in ci_patterns :
61
60
collect_only_result = pytest .main (
@@ -82,13 +81,14 @@ def test_ci_patterns_valid() -> None:
82
81
83
82
def test_tests_collected_once (
84
83
capsys : pytest .CaptureFixture [str ],
84
+ request : pytest .FixtureRequest ,
85
85
) -> None :
86
86
"""
87
87
Each test in the test suite is collected exactly once.
88
88
89
89
This does not necessarily mean that they are run - they may be skipped.
90
90
"""
91
- ci_patterns = _ci_patterns ()
91
+ ci_patterns = _ci_patterns (repository_root = request . config . rootpath )
92
92
tests_to_patterns : dict [str , set [str ]] = {}
93
93
94
94
for pattern in ci_patterns :
0 commit comments