Files
meetus/tests/__init__.py
2026-06-28 21:12:13 -03:00

30 lines
860 B
Python

"""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