18 lines
612 B
Python
18 lines
612 B
Python
"""Root conftest — ensures the project root is on sys.path.
|
|
|
|
Required when the virtual-environment Python is symlinked to an external
|
|
interpreter (e.g. Anaconda) that does not process the venv's .pth files
|
|
automatically. Adding the project root here makes ``codex`` importable
|
|
regardless of how pytest is invoked (``pytest``, ``python -m pytest``, etc.).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Insert the project root so `import codex` always resolves.
|
|
_project_root = str(Path(__file__).parent)
|
|
if _project_root not in sys.path:
|
|
sys.path.insert(0, _project_root)
|