"""Make the `app` package importable when running pytest from the backend dir. Without this, `pytest` fails to collect tests with `ModuleNotFoundError: No module named 'app'`. Insert the backend root (the parent of app/) onto sys.path so `python -m pytest` works from anywhere. """ import sys from pathlib import Path _BACKEND_ROOT = Path(__file__).resolve().parent.parent if str(_BACKEND_ROOT) not in sys.path: sys.path.insert(0, str(_BACKEND_ROOT))