Files
eDNA_Stream_E01_custom_models/tests/conftest.py
T
Tom Kasper 88e98effad Initial release: E1 genus probe package moved out of the E01 workflow
- src/custom_models torch modules, store, training, metrics, runner and CLI
  (package-relative imports for pip installability)
- test suite (49 tests) + conftest with fast synthetic-store fixtures
- uv-managed dev env (pyproject + CPU torch index), hatchling build
- README: uv for the package, pip install into conda envs for the workflow
2026-09-22 13:22:50 +01:00

51 lines
1.3 KiB
Python

"""Shared fixtures: fast synthetic stores (no pod5 needed) and determinism."""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
from custom_models.seed import seed_everything
from custom_models.store import synthetic_store
@pytest.fixture(autouse=True)
def _seed_every_test() -> None:
"""Seed all RNGs before each test (the GATE ZERO §2.3 contract)."""
seed_everything(0)
@pytest.fixture(scope="session")
def fast_store(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""A small 6-genus duty-cycle store for split/config tests."""
out = tmp_path_factory.mktemp("store") / "main"
synthetic_store(
out_dir=out,
n_genera=6,
reads_per_genus=12,
window_samples=1200,
shard_windows=8,
seed=0,
)
return out
@pytest.fixture(scope="session")
def trap_store(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""A small eval-only impostor store (and test-split source)."""
out = tmp_path_factory.mktemp("store") / "trap"
synthetic_store(
out_dir=out,
n_genera=2,
reads_per_genus=6,
window_samples=1200,
shard_windows=8,
seed=1,
genus_prefix="trap_",
)
return out