Spaces:
Paused
Paused
Download tests/conftest.py from drrobot9/neural-forge: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/spaces/drrobot9/neural-forge/resolve/main/tests/conftest.py
- Command line
-
hf download hf://spaces/drrobot9/neural-forge/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/spaces/drrobot9/neural-forge/resolve/main/tests/conftest.py
1.62 kB
| import os | |
| import sys | |
| from pathlib import Path | |
| import pytest | |
| REPOSITORY_ROOT = Path(__file__).resolve().parents[1] | |
| sys.path.insert(0, str(REPOSITORY_ROOT)) | |
| os.environ.setdefault("LOAD_QWEN_ON_STARTUP", "0") | |
| EYE_MODEL_DIRECTORY = os.getenv("NEURAL_FORGE_EYE_MODEL_DIRECTORY", "").strip() | |
| if EYE_MODEL_DIRECTORY: | |
| os.environ["EYE_MODEL_LOCAL_DIRECTORY"] = EYE_MODEL_DIRECTORY | |
| def eye_model_directory() -> Path | None: | |
| return Path(EYE_MODEL_DIRECTORY) if EYE_MODEL_DIRECTORY and Path(EYE_MODEL_DIRECTORY).is_dir() else None | |
| def eye_models(): | |
| """The approved eye models loaded from NEURAL_FORGE_EYE_MODEL_DIRECTORY (a local copy of the private model repository).""" | |
| if eye_model_directory() is None: | |
| pytest.skip("NEURAL_FORGE_EYE_MODEL_DIRECTORY is not set to a local copy of drrobot9/neural-forge-eye-models") | |
| from neural_forge.eye_models import EYE_MODELS | |
| EYE_MODELS.load() | |
| failed = {name: status for name, status in EYE_MODELS.status.items() if status != "ready"} | |
| assert not failed, f"Eye models failed to load: {failed} {EYE_MODELS.errors}" | |
| return EYE_MODELS | |
| def fixtures_directory(): | |
| directory = eye_model_directory() | |
| if directory is None or not (directory / "test_fixtures").is_dir(): | |
| pytest.skip("Test fixtures from the private model repository are not available") | |
| return directory / "test_fixtures" | |
| def exam_log_directory(tmp_path, monkeypatch): | |
| monkeypatch.setenv("EXAM_LOG_DIRECTORY", str(tmp_path / "exam_logs")) | |
| return tmp_path / "exam_logs" | |