Skip to content

Commit 85c976a

Browse files
author
planet.jeroen
committed
fix(tests): use sys.executable instead of hardcoded venv path
Subprocess tests for CLI --load-session and --headless used a hardcoded "venv/bin/python3" path that breaks in CI and when the local project directory is renamed.
1 parent 1821887 commit 85c976a

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

tests/test_viewer_server.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import ast
1212
import json
13+
import sys
1314
import threading
1415
import time
1516
import urllib.request
@@ -2108,7 +2109,7 @@ def test_load_session_argument_accepted(self):
21082109
"""CLI parser must accept --load-session argument."""
21092110
import subprocess
21102111
result = subprocess.run(
2111-
["venv/bin/python3", "-m", "humeris.cli", "--help"],
2112+
[sys.executable, "-m", "humeris.cli", "--help"],
21122113
capture_output=True, text=True, timeout=10,
21132114
)
21142115
assert "--load-session" in result.stdout
@@ -2118,7 +2119,7 @@ def test_load_session_file_not_found(self, tmp_path):
21182119
import subprocess
21192120
result = subprocess.run(
21202121
[
2121-
"venv/bin/python3", "-m", "humeris.cli",
2122+
sys.executable, "-m", "humeris.cli",
21222123
"--serve", "--load-session", "/nonexistent/session.json",
21232124
],
21242125
capture_output=True, text=True, timeout=10,
@@ -2133,7 +2134,7 @@ def test_load_session_invalid_json(self, tmp_path):
21332134
bad_file.write_text("not json at all")
21342135
result = subprocess.run(
21352136
[
2136-
"venv/bin/python3", "-m", "humeris.cli",
2137+
sys.executable, "-m", "humeris.cli",
21372138
"--serve", "--load-session", str(bad_file),
21382139
],
21392140
capture_output=True, text=True, timeout=10,
@@ -2348,7 +2349,7 @@ def test_headless_argument_accepted(self):
23482349
"""CLI parser must accept --headless argument."""
23492350
import subprocess
23502351
result = subprocess.run(
2351-
["venv/bin/python3", "-m", "humeris.cli", "--help"],
2352+
[sys.executable, "-m", "humeris.cli", "--help"],
23522353
capture_output=True, text=True, timeout=10,
23532354
)
23542355
assert "--headless" in result.stdout
@@ -2358,7 +2359,7 @@ def test_headless_requires_load_session(self):
23582359
import subprocess
23592360
result = subprocess.run(
23602361
[
2361-
"venv/bin/python3", "-m", "humeris.cli",
2362+
sys.executable, "-m", "humeris.cli",
23622363
"--serve", "--headless",
23632364
],
23642365
capture_output=True, text=True, timeout=10,
@@ -2391,7 +2392,7 @@ def test_headless_export_czml(self, tmp_path):
23912392

23922393
result = subprocess.run(
23932394
[
2394-
"venv/bin/python3", "-m", "humeris.cli",
2395+
sys.executable, "-m", "humeris.cli",
23952396
"--serve", "--headless",
23962397
"--load-session", str(session_file),
23972398
"--export-czml", str(output_dir),

0 commit comments

Comments
 (0)