From df03c52a05e1659677657dd5008863ca0601ea95 Mon Sep 17 00:00:00 2001 From: Maximilian Eibl Date: Fri, 4 Sep 2026 15:56:37 +0200 Subject: [PATCH] Update tests/test_pipeline.py to resolve paths relative to repository root and src/ directory --- tests/test_pipeline.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 21ccb5c..3f4d8f2 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -9,8 +9,11 @@ import urllib.request import warnings from datetime import datetime, timezone, timedelta -# Ensure src/ directory is in sys.path -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "src"))) +# Ensure repository root and src/ directory are in sys.path +ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) +SRC_DIR = os.path.join(ROOT_DIR, "src") +sys.path.insert(0, ROOT_DIR) +sys.path.insert(0, SRC_DIR) warnings.filterwarnings("ignore") import pgpy @@ -23,13 +26,16 @@ HERMES_PORT = 8443 def run_tests(): print("=== [1] Verifying server_config.json & client_config.json ===") - assert os.path.exists("server_config.json"), "server_config.json must exist" - assert os.path.exists("client_config.json"), "client_config.json must exist" + server_cfg_path = "server_config.json" if os.path.exists("server_config.json") else os.path.join(ROOT_DIR, "server_config.json") + client_cfg_path = "client_config.json" if os.path.exists("client_config.json") else os.path.join(ROOT_DIR, "client_config.json") + + assert os.path.exists(server_cfg_path), f"{server_cfg_path} must exist" + assert os.path.exists(client_cfg_path), f"{client_cfg_path} must exist" - with open("client_config.json", "r", encoding="utf-8") as f: + with open(client_cfg_path, "r", encoding="utf-8") as f: client_conf = json.load(f) - with open("server_config.json", "r", encoding="utf-8") as f: + with open(server_cfg_path, "r", encoding="utf-8") as f: server_conf = json.load(f) assert "server_name" not in client_conf, "client_config.json must NOT contain server_name"