Skip to content

Commit

Permalink
test: Python test fixes: GSF + EDM4hep (#4088)
Browse files Browse the repository at this point in the history
This fixes a few small issues with the GSF debugger (shebangs) and using the python interpreter that runs pytest (otherwise modules might not be available).

It also forces DD4hep to write EDM4hep for the EDM4hep ddsim run, which gives a better error message if DD4hep was built without EDM4hep.
  • Loading branch information
paulgessinger authored Feb 13, 2025
1 parent 260a143 commit 9b97473
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Examples/Python/tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_gsf_debugger(tmp_path):
env = os.environ.copy()
env["PYTHONPATH"] = f"{scriptdir}:{env['PYTHONPATH']}"
gsf_result = subprocess.run(
[gsf_script], capture_output=True, cwd=tmp_path, env=env
[sys.executable, gsf_script], capture_output=True, cwd=tmp_path, env=env
)

logfile = tmp_path / "test.log"
Expand All @@ -54,6 +54,6 @@ def test_gsf_debugger(tmp_path):
assert gsf_result.returncode == 0

debugger_result = subprocess.run(
[debugger, f"--logfile={logfile}", "--nogui"], cwd=tmp_path
[sys.executable, debugger, f"--logfile={logfile}", "--nogui"], cwd=tmp_path
)
assert debugger_result.returncode == 0
1 change: 1 addition & 0 deletions Examples/Python/tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def generate_input_test_edm4hep_simhit_reader(input, output):
ddsim.gun.distribution = "eta"
ddsim.numberOfEvents = 10
ddsim.outputFile = output
ddsim.outputConfig.forceEDM4HEP = True
ddsim.run()


Expand Down
2 changes: 1 addition & 1 deletion Examples/Scripts/GsfDebugger/make_gsf_verbose_log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

from pathlib import Path

Expand Down
2 changes: 1 addition & 1 deletion Examples/Scripts/GsfDebugger/src/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/env python3
#!/usr/bin/env python3
import argparse
import os
import sys
Expand Down

0 comments on commit 9b97473

Please sign in to comment.