docs: new repo URL (andrew/...), requirements.txt, pytest smoke tests + CI
This commit is contained in:
1 parent
0235a0f597
commit
a568ebb182
10 files changed
+403
-1
No files matched your search
@@ -0,0 +1,28 @@
|
||||
"""Smoke tests for config loader (src/config.py). Needs python-dotenv only."""
|
||||
|
||||
from src.config import load_config
|
||||
|
||||
_KEYS = [
|
||||
"LOCAL_RTSP", "JETSON_RTSP", "MODEL_SACK_PATH", "MODEL_TRUCK_PATH",
|
||||
"COUNTING_LINE_Y", "COUNTING_LINE_X_START", "COUNTING_LINE_X_END",
|
||||
"SACK_CONF_THRESHOLD", "TRUCK_CONF_THRESHOLD", "BATCH_TIMEOUT_SECONDS",
|
||||
"CSV_OUTPUT_DIR", "DATA_SEED",
|
||||
]
|
||||
|
||||
|
||||
def test_load_from_env_file(tmp_path, monkeypatch):
|
||||
for k in _KEYS:
|
||||
monkeypatch.delenv(k, raising=False)
|
||||
env = tmp_path / "test.env"
|
||||
env.write_text(
|
||||
"LOCAL_RTSP=rtsp://cam/1\n"
|
||||
"MODEL_SACK_PATH=/m/sack.pt\n"
|
||||
"MODEL_TRUCK_PATH=/m/truck.pt\n"
|
||||
"SACK_CONF_THRESHOLD=0.55\n"
|
||||
)
|
||||
cfg = load_config(str(env))
|
||||
assert cfg.local_rtsp == "rtsp://cam/1"
|
||||
assert cfg.sack_model_path == "/m/sack.pt"
|
||||
assert cfg.truck_model_path == "/m/truck.pt"
|
||||
assert cfg.sack_conf == 0.55
|
||||
assert cfg.truck_conf == 0.50 # default preserved
|
||||
Reference in new issue
Block a user