conftest.py 473 B

1234567891011121314151617
  1. """Pytest configuration helpers for path setup to include src/ on sys.path."""
  2. import sys
  3. from pathlib import Path
  4. def _ensure_src_on_syspath():
  5. """Prepend the repository src/ path onto sys.path for import resolution."""
  6. root = Path(__file__).resolve().parents[1]
  7. src = root / "src"
  8. src_str = str(src)
  9. # Insert at position 0 to ensure it takes precedence
  10. if src_str not in sys.path:
  11. sys.path.insert(0, src_str)
  12. _ensure_src_on_syspath()