Spaces:
Sleeping
Sleeping
| import json | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| import pytest | |
| BACKEND = Path(__file__).resolve().parent.parent | |
| WORKSPACE = BACKEND.parent.parent | |
| FIXTURES = Path(__file__).parent / "fixtures" | |
| AI_MASK = WORKSPACE / "AI_mask" / "AI_mask" | |
| def ensure_fixtures(): | |
| manifest = FIXTURES / "manifest.json" | |
| if not manifest.exists(): | |
| subprocess.run([sys.executable, str(Path(__file__).parent / "generate_fixtures.py")], check=True) | |
| yield | |
| def fixtures_dir() -> Path: | |
| return FIXTURES | |
| def manifest(fixtures_dir) -> dict: | |
| return json.loads((fixtures_dir / "manifest.json").read_text(encoding="utf-8")) | |
| def aadhaar_images() -> list[Path]: | |
| paths = [AI_MASK / f"a{i}.jpg" for i in range(1, 5)] | |
| return [p for p in paths if p.exists()] | |
| def pan_image() -> Path | None: | |
| p = AI_MASK / "p1.jpg" | |
| return p if p.exists() else None | |