Download backend/tests/conftest.py from Shwy1001/BioPatch: direct link, hf CLI and curl.
- Browser
- Download file 746 Bytes
-
https://huggingface.co/spaces/Shwy1001/BioPatch/resolve/main/backend/tests/conftest.py
- Command line
-
hf download hf://spaces/Shwy1001/BioPatch/backend/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/spaces/Shwy1001/BioPatch/resolve/main/backend/tests/conftest.py
746 Bytes
| """Pytest fixtures shared across the BioPatch test suite.""" | |
| from __future__ import annotations | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| import pytest | |
| ROOT = Path(__file__).resolve().parent.parent | |
| def ensure_clinical_model_trained() -> None: | |
| """Make sure the RF artifact exists before any test runs. | |
| The training pipeline is deterministic (seed=42) and finishes in <2s, | |
| so re-running it in CI is cheap and keeps tests model-faithful. | |
| """ | |
| artifact = ROOT / "ai" / "artifacts" / "rf_v1.joblib" | |
| if artifact.exists(): | |
| return | |
| subprocess.run( | |
| [sys.executable, "-m", "scripts.seed_clinical_data"], | |
| cwd=ROOT, | |
| check=True, | |
| ) | |