Skip to content

Commit 26727b0

Browse files
authored
Improve adt server executable detection in tests (#538)
'adt' is located at `/usr/local/bin/adt` in the container, but it was being looked for in the directory that python was run from `/usr/bin/` Instead of relying on sys.executable path to find the server binary, use shutil.which() to locate 'adt' in $PATH. This makes the testing setup more robust. Signed-off-by: Sebastian Yaghoubi <[email protected]>
1 parent 98ac0ea commit 26727b0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import shlex
2929
import shutil
3030
import subprocess
31-
import sys
3231
import time
3332

3433
from dataclasses import dataclass
@@ -440,7 +439,10 @@ def _start_server() -> None:
440439
Raises:
441440
RuntimeError: If the server could not be started.
442441
"""
443-
bin_path = Path(sys.executable).parent / "adt"
442+
bin_path = shutil.which("adt")
443+
if bin_path is None:
444+
msg = "adt not found in $PATH"
445+
raise RuntimeError(msg)
444446
INFRASTRUCTURE.proc = subprocess.Popen( # noqa: S603
445447
[bin_path, "server", "-p", "8000"],
446448
env=os.environ,

0 commit comments

Comments
 (0)