Download tests/conftest.py from tailot/lingologos-physics: direct link, hf CLI and curl.
- Browser
- Download file 846 Bytes
-
https://huggingface.co/datasets/tailot/lingologos-physics/resolve/main/tests/conftest.py
- Command line
-
hf download hf://datasets/tailot/lingologos-physics/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/datasets/tailot/lingologos-physics/resolve/main/tests/conftest.py
846 Bytes
| """Make the physics package importable when pytest is started from the repository root.""" | |
| import sys | |
| from pathlib import Path | |
| # A dataset that writes byte code caches next to its sources is not a dataset a reader can pick up | |
| # and read: no test in this folder leaves a __pycache__ behind. | |
| sys.dont_write_bytecode = True | |
| ROOT = Path(__file__).resolve().parents[1] | |
| if str(ROOT) not in sys.path: | |
| sys.path.insert(0, str(ROOT)) | |
| # Inside the repository the bundle is several levels below the orchestrator package, so look for an | |
| # ancestor that carries src/lingologos_orchestrator instead of assuming the bundle sits at the root. | |
| for _parent in ROOT.parents: | |
| _candidate = _parent / "src" | |
| if (_candidate / "lingologos_orchestrator").is_dir() and str(_candidate) not in sys.path: | |
| sys.path.insert(0, str(_candidate)) | |
| break | |