You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.0 KiB
29 lines
1.0 KiB
import re
|
|
from pathlib import Path
|
|
|
|
try:
|
|
import yaml # type: ignore
|
|
except Exception:
|
|
yaml = None
|
|
|
|
|
|
def test_manifest_loads():
|
|
"""Ensure the .mindmodel/manifest.yaml can be read and contains a 'files' list."""
|
|
p = Path(".mindmodel/manifest.yaml")
|
|
assert p.exists(), ".mindmodel/manifest.yaml must exist"
|
|
text = p.read_text(encoding="utf-8")
|
|
|
|
if yaml is not None:
|
|
data = yaml.safe_load(text)
|
|
assert isinstance(data, dict), "manifest should parse to a mapping"
|
|
assert "files" in data, "top-level 'files' key missing"
|
|
assert isinstance(data["files"], list), "'files' should be a list"
|
|
assert len(data["files"]) >= 1, "'files' must have at least one entry"
|
|
else:
|
|
# Fallback simple checks if PyYAML is not available in the environment.
|
|
assert re.search(r"^\s*files:\s*$", text, re.M), (
|
|
"manifest must contain top-level 'files:'"
|
|
)
|
|
assert re.search(r"^\s*-\s+path:\s+", text, re.M), (
|
|
"manifest must contain at least one '- path:' entry"
|
|
)
|
|
|