File tree Expand file tree Collapse file tree 1 file changed +22
-7
lines changed Expand file tree Collapse file tree 1 file changed +22
-7
lines changed Original file line number Diff line number Diff line change 6
6
This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`.
7
7
You can run it manually with `pre-commit run check-no-tests-are-ignored --all`.
8
8
"""
9
-
9
+ import logging
10
10
import re
11
11
12
12
from pathlib import Path
13
13
14
+ _log = logging .getLogger (__file__ )
15
+
16
+
14
17
if __name__ == "__main__" :
15
18
testing_workflows = ["jaxtests.yml" , "pytest.yml" ]
16
19
ignored = set ()
20
23
txt = pytest_ci_job .read_text ()
21
24
ignored = set (re .findall (r"(?<=--ignore=)(pymc3/tests.*\.py)" , txt ))
22
25
non_ignored = non_ignored .union (set (re .findall (r"(?<!--ignore=)(pymc3/tests.*\.py)" , txt )))
23
- assert (
24
- ignored <= non_ignored
25
- ), f"The following tests are ignored by the first job but not run by the others: { ignored .difference (non_ignored )} "
26
- assert (
27
- ignored >= non_ignored
28
- ), f"The following tests are run by multiple jobs: { non_ignored .difference (ignored )} "
26
+ # Summarize
27
+ ignored_by_all = ignored .difference (non_ignored )
28
+ run_multiple_times = non_ignored .difference (ignored )
29
+
30
+ if ignored_by_all :
31
+ _log .warning (
32
+ f"The following { len (ignored_by_all )} tests are completely ignored: { ignored_by_all } "
33
+ )
34
+ if run_multiple_times :
35
+ _log .warning (
36
+ f"The following { len (run_multiple_times )} tests are run multiple times: { run_multiple_times } "
37
+ )
38
+ if not (ignored_by_all or run_multiple_times ):
39
+ print (f"✔ All tests will run exactly once." )
40
+
41
+ # Temporarily disabled as we're bringing features back for v4:
42
+ # assert not ignored_by_all
43
+ assert not run_multiple_times
You can’t perform that action at this time.
0 commit comments