Skip to content

Commit 0bb4e74

Browse files
Resolve DMS test helper scripts by path on Windows
1 parent 6afc1d8 commit 0bb4e74

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • acceptance/bundle/dms_fault

‎acceptance/bundle/dms_fault/run.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
import re
77
import shlex
8-
import shutil
98
import subprocess
109
import sys
1110
from pathlib import Path
@@ -14,7 +13,9 @@
1413

1514
# Keep acceptance-only setup out of imports used by doctest.
1615
def main():
17-
sys.path.insert(0, str(Path(shutil.which("print_requests.py")).parent))
16+
# Use file paths: Windows does not reliably find Python scripts on PATH.
17+
HELPERS = Path(__file__).resolve().parents[2] / "bin"
18+
sys.path.insert(0, str(HELPERS))
1819
from add_repl import add_repl
1920
from print_requests import read_json_many
2021

@@ -67,7 +68,7 @@ def run(cwd, *args, expected=0):
6768
# Enable or clear an HTTP 500 fault for this endpoint.
6869
def fault(pattern, enabled):
6970
subprocess.run(
70-
[sys.executable, shutil.which("fault.py"), pattern, "500", "0", "1000" if enabled else "0"], check=True
71+
[sys.executable, str(HELPERS / "fault.py"), pattern, "500", "0", "1000" if enabled else "0"], check=True
7172
)
7273

7374
# Count recorded method/path matches to report whether this API was called.
@@ -165,7 +166,7 @@ def set_history(cwd, enabled):
165166
subprocess.run(
166167
[
167168
sys.executable,
168-
shutil.which("update_file.py"),
169+
str(HELPERS / "update_file.py"),
169170
str(cwd / filename),
170171
prefix + previous,
171172
prefix + value,

0 commit comments

Comments
 (0)