fix(resources): guard non-dict YAML in load_profile; remove unused FIXTURES constant
This commit is contained in:
parent
c6a58b6a37
commit
bfc1f7b7b9
2 changed files with 2 additions and 3 deletions
|
|
@ -55,6 +55,8 @@ class GpuProfile(BaseModel):
|
||||||
|
|
||||||
def load_profile(path: Path) -> GpuProfile:
|
def load_profile(path: Path) -> GpuProfile:
|
||||||
raw: dict[str, Any] = yaml.safe_load(path.read_text())
|
raw: dict[str, Any] = yaml.safe_load(path.read_text())
|
||||||
|
if not isinstance(raw, dict):
|
||||||
|
raise ValueError(f"Profile file {path} must be a YAML mapping, got {type(raw).__name__}")
|
||||||
version = raw.get("schema_version")
|
version = raw.get("schema_version")
|
||||||
if version != SUPPORTED_SCHEMA_VERSION:
|
if version != SUPPORTED_SCHEMA_VERSION:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,9 @@
|
||||||
# tests/test_resources/test_profile_registry.py
|
# tests/test_resources/test_profile_registry.py
|
||||||
import pytest
|
import pytest
|
||||||
from pathlib import Path
|
|
||||||
from circuitforge_core.resources.profiles.schema import (
|
from circuitforge_core.resources.profiles.schema import (
|
||||||
GpuProfile, ServiceProfile, load_profile
|
GpuProfile, ServiceProfile, load_profile
|
||||||
)
|
)
|
||||||
|
|
||||||
FIXTURES = Path(__file__).parent / "fixtures"
|
|
||||||
|
|
||||||
|
|
||||||
def test_load_8gb_profile(tmp_path):
|
def test_load_8gb_profile(tmp_path):
|
||||||
yaml_content = """
|
yaml_content = """
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue