From bfc1f7b7b9b5f3b913d87bc8b144794f3743f4f4 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Mon, 30 Mar 2026 20:30:30 -0700 Subject: [PATCH] fix(resources): guard non-dict YAML in load_profile; remove unused FIXTURES constant --- circuitforge_core/resources/profiles/schema.py | 2 ++ tests/test_resources/test_profile_registry.py | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/circuitforge_core/resources/profiles/schema.py b/circuitforge_core/resources/profiles/schema.py index f3cc808..ac59020 100644 --- a/circuitforge_core/resources/profiles/schema.py +++ b/circuitforge_core/resources/profiles/schema.py @@ -55,6 +55,8 @@ class GpuProfile(BaseModel): def load_profile(path: Path) -> GpuProfile: 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") if version != SUPPORTED_SCHEMA_VERSION: raise ValueError( diff --git a/tests/test_resources/test_profile_registry.py b/tests/test_resources/test_profile_registry.py index 4e808ff..5265bc0 100644 --- a/tests/test_resources/test_profile_registry.py +++ b/tests/test_resources/test_profile_registry.py @@ -1,12 +1,9 @@ # tests/test_resources/test_profile_registry.py import pytest -from pathlib import Path from circuitforge_core.resources.profiles.schema import ( GpuProfile, ServiceProfile, load_profile ) -FIXTURES = Path(__file__).parent / "fixtures" - def test_load_8gb_profile(tmp_path): yaml_content = """