aisim-data / tests /test_validation.py
nv-simonec's picture
Bootstrap category-first AISimulate data storage
a0fd5b3
Raw History Blame
1.31 kB
from pathlib import Path
import yaml
from scripts.validate import DATA, schema_validator, validate, validate_manifest
FIXTURES = Path(__file__).parent / "fixtures"
def test_repository_data_is_valid():
assert validate() == []
def test_unknown_manifest_field_is_rejected(tmp_path: Path):
document = yaml.safe_load((FIXTURES / "invalid-e2e-manifest.yaml").read_text())
errors = list(schema_validator("e2e").iter_errors(document))
assert errors
def test_valid_fixture_matches_schema():
document = yaml.safe_load((FIXTURES / "valid-e2e-manifest.yaml").read_text())
assert list(schema_validator("e2e").iter_errors(document)) == []
def test_path_identity_is_enforced(tmp_path: Path):
source = next(DATA.glob("e2e/**/manifest.yaml"))
target = DATA / "e2e/deepseek-ai--DeepSeek-V4-Pro/H100/vllm/0.25.1/tp8/manifest.yaml"
target.parent.mkdir(parents=True, exist_ok=True)
target.write_bytes(source.read_bytes())
try:
assert any("path identity" in error for error in validate_manifest(target))
finally:
target.unlink()
for parent in [target.parent, target.parent.parent, target.parent.parent.parent, target.parent.parent.parent.parent]:
try:
parent.rmdir()
except OSError:
break