forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_misc.py
More file actions
59 lines (49 loc) · 1.32 KB
/
test_misc.py
File metadata and controls
59 lines (49 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from pathlib import Path
import os
import json
import functools
import tarfile
import urllib.request
import subprocess
import sys
import re
import collections
import pytest
from helpers import (
geant4Enabled,
rootEnabled,
dd4hepEnabled,
hepmc3Enabled,
pythia8Enabled,
gnnEnabled,
onnxEnabled,
AssertCollectionExistsAlg,
failure_threshold,
)
def test_gsf_debugger(tmp_path):
path = (
Path(__file__).parent.parent.parent.parent
/ "Examples"
/ "Scripts"
/ "GsfDebugger"
)
scriptdir = (
Path(__file__).parent.parent.parent.parent / "Examples" / "Scripts" / "Python"
)
gsf_script = path / "make_gsf_verbose_log.py"
assert gsf_script.exists()
debugger = path / "src/main.py"
assert debugger.exists()
env = os.environ.copy()
env["PYTHONPATH"] = f"{scriptdir}:{env['PYTHONPATH']}"
gsf_result = subprocess.run(
[sys.executable, gsf_script], capture_output=True, cwd=tmp_path, env=env
)
logfile = tmp_path / "test.log"
with open(logfile, "w") as f:
f.write(gsf_result.stdout.decode("utf8"))
assert gsf_result.returncode == 0
debugger_result = subprocess.run(
[sys.executable, debugger, f"--logfile={logfile}", "--nogui"], cwd=tmp_path
)
assert debugger_result.returncode == 0