diff --git a/tests/test_log.py b/tests/test_log.py index 93c9b93..dcdd005 100644 --- a/tests/test_log.py +++ b/tests/test_log.py @@ -24,6 +24,7 @@ from logbar.buffer import QueueingStdout, get_buffered_stdout log = LogBar.shared(override_logger=True) +REPO_ROOT = Path(__file__).resolve().parents[1] ANSI_ESCAPE_RE = re.compile(r"\x1b\[[0-9;?]*[ -/]*[@-~]") @@ -921,15 +922,15 @@ def test_warning_summary_with_leaked_live_stack(): env = dict(os.environ) existing_pythonpath = env.get("PYTHONPATH", "") env["PYTHONPATH"] = ( - f"/root/LogBar{os.pathsep}{existing_pythonpath}" + f"{REPO_ROOT}{os.pathsep}{existing_pythonpath}" if existing_pythonpath - else "/root/LogBar" + else str(REPO_ROOT) ) command = f"{shlex.quote(pytest_bin)} -s -v {shlex.quote(str(repro_path))}" completed = subprocess.run( [script_bin, "-q", "-c", command, str(transcript_path)], - cwd="/root/LogBar", + cwd=str(REPO_ROOT), env=env, capture_output=True, text=True, diff --git a/tests/test_progress.py b/tests/test_progress.py index 8af644f..da14598 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -4,6 +4,7 @@ # Contact: qubitium@modelcloud.ai, x.com/qubitium import os +from pathlib import Path import subprocess import random import re @@ -21,6 +22,7 @@ from logbar.logbar import _active_progress_bars log = LogBar.shared(override_logger=True) +REPO_ROOT = Path(__file__).resolve().parents[1] ANSI_ESCAPE_RE = re.compile(r"\x1b\[[0-9;?]*[ -/]*[@-~]") @@ -234,7 +236,7 @@ def test_title_animation_respects_logbar_animation_env(self): enabled = subprocess.run( [sys.executable, "-c", script], - cwd="/root/LogBar", + cwd=str(REPO_ROOT), capture_output=True, text=True, env={}, @@ -244,7 +246,7 @@ def test_title_animation_respects_logbar_animation_env(self): disabled = subprocess.run( [sys.executable, "-c", script], - cwd="/root/LogBar", + cwd=str(REPO_ROOT), capture_output=True, text=True, env={"LOGBAR_ANIMATION": "0"},