Skip to content

Commit 2479efc

Browse files
committed
only run a subset of the tutorials' list
1 parent 94cb626 commit 2479efc

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

test_tutorials/test_tutorials.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,21 @@
1010

1111
tutorial_dir = pathlib.Path(str(ROOT.gROOT.GetTutorialDir()))
1212

13+
subdirs = [
14+
"analysis/dataframe",
15+
"analysis/tree",
16+
"hist",
17+
"io/ntuple",
18+
"roofit/roofit"
19+
]
20+
1321
# ----------------------
1422
# Python tutorials tests
1523
# ----------------------
16-
py_tutorials = list(tutorial_dir.rglob("*.py"))
24+
py_tutorials = []
25+
for sub in subdirs:
26+
sub_path = tutorial_dir / sub
27+
py_tutorials.extend(sub_path.rglob("*.py"))
1728

1829
def test_tutorials_are_detected():
1930
assert len(py_tutorials) > 0
@@ -43,15 +54,16 @@ def test_tutorial(tutorial):
4354
# ----------------------
4455
# C++ tutorials tests
4556
# ----------------------
46-
cpp_tutorials = list(tutorial_dir.rglob("*.C"))
57+
cpp_tutorials = []
58+
for sub in subdirs:
59+
sub_path = tutorial_dir / sub
60+
cpp_tutorials.extend(sub_path.rglob("*.C"))
4761

4862
def test_cpp_tutorials_are_detected():
4963
assert len(cpp_tutorials) > 0
5064

5165
@pytest.mark.parametrize("tutorial", cpp_tutorials, ids=lambda p: p.name)
5266
def test_cpp_tutorial(tutorial):
53-
# ROOT.gROOT.ProcessLine(f".x {tutorial}")
54-
5567
try:
5668
result = subprocess.run(
5769
[sys.executable, "-c", f'import ROOT; ROOT.gROOT.ProcessLine(".x {tutorial}")'],
@@ -64,7 +76,7 @@ def test_cpp_tutorial(tutorial):
6476
pytest.skip(f"Tutorial {tutorial} timed out")
6577
except subprocess.CalledProcessError as e:
6678
if e.returncode == -signal.SIGILL or e.returncode == 132:
67-
pytest.skip(f"Skipping {tutorial.name} (illegal instruction on this platform)")
79+
pytest.fail(f"Failing {tutorial.name} (illegal instruction on this platform)")
6880
elif "EOFError" in e.stderr:
6981
pytest.skip(f"Skipping {tutorial.name} (requires user input)")
7082
raise

0 commit comments

Comments
 (0)