diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..97da40f --- /dev/null +++ b/conftest.py @@ -0,0 +1,17 @@ +"""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)