refactor (untested)

This commit is contained in:
Mariano Gabriel
2026-06-28 21:12:13 -03:00
parent 5ea05eb553
commit cc64544d50
26 changed files with 540 additions and 340 deletions

29
tests/__init__.py Normal file
View File

@@ -0,0 +1,29 @@
"""Smoke + focused tests for meetus.
Run from the repo root:
python -m unittest discover -s tests -t . -v
This package's import makes the repo importable and provides a `cv2` stub (only
cv2 is missing in minimal envs; numpy/PIL are real and not shadowed).
"""
import os
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent.parent
STUBS_DIR = Path(__file__).resolve().parent / "_stubs"
for _p in (str(STUBS_DIR), str(REPO_ROOT)):
if _p not in sys.path:
sys.path.insert(0, _p)
def subprocess_env(extra=None):
"""Env for subprocess tests: repo root + cv2 stub on PYTHONPATH."""
env = dict(os.environ)
pp = env.get("PYTHONPATH", "")
parts = [str(REPO_ROOT), str(STUBS_DIR)] + ([pp] if pp else [])
env["PYTHONPATH"] = os.pathsep.join(parts)
if extra:
env.update(extra)
return env