File size: 1,307 Bytes
a0fd5b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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