Update tests/test_pipeline.py to resolve paths relative to repository root and src/ directory
This commit is contained in:
+12
-6
@@ -9,8 +9,11 @@ import urllib.request
|
|||||||
import warnings
|
import warnings
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime, timezone, timedelta
|
||||||
|
|
||||||
# Ensure src/ directory is in sys.path
|
# Ensure repository root and src/ directory are in sys.path
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "src")))
|
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")
|
warnings.filterwarnings("ignore")
|
||||||
import pgpy
|
import pgpy
|
||||||
@@ -23,13 +26,16 @@ HERMES_PORT = 8443
|
|||||||
|
|
||||||
def run_tests():
|
def run_tests():
|
||||||
print("=== [1] Verifying server_config.json & client_config.json ===")
|
print("=== [1] Verifying server_config.json & client_config.json ===")
|
||||||
assert os.path.exists("server_config.json"), "server_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")
|
||||||
assert os.path.exists("client_config.json"), "client_config.json must exist"
|
client_cfg_path = "client_config.json" if os.path.exists("client_config.json") else os.path.join(ROOT_DIR, "client_config.json")
|
||||||
|
|
||||||
with open("client_config.json", "r", encoding="utf-8") as f:
|
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_cfg_path, "r", encoding="utf-8") as f:
|
||||||
client_conf = json.load(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)
|
server_conf = json.load(f)
|
||||||
|
|
||||||
assert "server_name" not in client_conf, "client_config.json must NOT contain server_name"
|
assert "server_name" not in client_conf, "client_config.json must NOT contain server_name"
|
||||||
|
|||||||
Reference in New Issue
Block a user