File tree Expand file tree Collapse file tree 3 files changed +38
-5
lines changed Expand file tree Collapse file tree 3 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,13 @@ jobs:
21
21
--ignore=pymc3/tests/test_distributions_timeseries.py
22
22
--ignore=pymc3/tests/test_examples.py
23
23
--ignore=pymc3/tests/test_gp.py
24
+ --ignore=pymc3/tests/test_mixture.py
24
25
--ignore=pymc3/tests/test_parallel_sampling.py
25
26
--ignore=pymc3/tests/test_posteriors.py
26
27
--ignore=pymc3/tests/test_quadpotential.py
27
28
--ignore=pymc3/tests/test_random.py
28
29
--ignore=pymc3/tests/test_sampling.py
29
- --ignore=pymc3/tests/test_shape_handling
30
+ --ignore=pymc3/tests/test_shape_handling.py
30
31
--ignore=pymc3/tests/test_shared.py
31
32
--ignore=pymc3/tests/test_smc.py
32
33
--ignore=pymc3/tests/test_updates.py
44
45
- |
45
46
pymc3/tests/test_examples.py
46
47
pymc3/tests/test_gp.py
48
+ pymc3/tests/test_mixture.py
47
49
pymc3/tests/test_posteriors.py
48
50
pymc3/tests/test_quadpotential.py
49
51
- |
Original file line number Diff line number Diff line change @@ -31,14 +31,21 @@ repos:
31
31
- repo : local
32
32
hooks :
33
33
- id : watermark
34
- name : Check notebooks have watermark (see Jupyter style guide from PyMC3 Wiki)
35
- types : [jupyter]
34
+ args : [--negate, --multiline]
36
35
entry : ' %load_ext watermark.*%watermark -n -u -v -iv -w'
37
36
language : pygrep
38
- args : [--negate, --multiline]
39
37
minimum_pre_commit_version : 2.8.0
38
+ name : Check notebooks have watermark (see Jupyter style guide from PyMC3 Wiki)
39
+ types : [jupyter]
40
40
- id : check-toc
41
+ entry : python scripts/check_toc_is_complete.py
42
+ language : python
41
43
name : Check all notebooks appear in table of contents
44
+ pass_filenames : false
42
45
types : [jupyter]
43
- entry : python scripts/check_toc_is_complete.py
46
+ - id : check-no-tests-are-ignored
47
+ entry : python scripts/check_all_tests_are_covered.py
48
+ files : ^\.github/workflows/pytest\.yml$
44
49
language : python
50
+ name : Check no tests are ignored
51
+ pass_filenames : false
Original file line number Diff line number Diff line change
1
+ """
2
+ In .github/workflows/pytest.yml, tests are split between multiple jobs.
3
+
4
+ Here, we check that the jobs ignored by the first job actually end up getting
5
+ run by the other jobs.
6
+ This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`.
7
+ You can run it manually with `pre-commit run check-no-tests-are-ignored --all`.
8
+ """
9
+
10
+ from pathlib import Path
11
+
12
+ import re
13
+
14
+ if __name__ == "__main__" :
15
+ pytest_ci_job = Path (".github" ) / "workflows/pytest.yml"
16
+ txt = pytest_ci_job .read_text ()
17
+ ignored_tests = set (re .findall (r"(?<=--ignore=)(pymc3/tests.*\.py)" , txt ))
18
+ non_ignored_tests = set (re .findall (r"(?<!--ignore=)(pymc3/tests.*\.py)" , txt ))
19
+ assert (
20
+ ignored_tests <= non_ignored_tests
21
+ ), f"The following tests are ignored by the first job but not run by the others: { ignored_tests .difference (non_ignored_tests )} "
22
+ assert (
23
+ ignored_tests >= non_ignored_tests
24
+ ), f"The following tests are run by multiple jobs: { non_ignored_tests .difference (ignored_tests )} "
You can’t perform that action at this time.
0 commit comments