spriteforge/tests/test_backend_registry.py

14 lines
708 B
Python
Raw Normal View History

import pytest
from spriteforge.backend_registry import register_backend_contract
from spriteforge.manifest import ManifestInvalid, load_manifest
def test_unknown_backend_is_rejected(tmp_path):
path=tmp_path/"bad.yaml";path.write_text("thing:\n backend: typo_backend\n")
with pytest.raises(ManifestInvalid,match="unknown backend"): load_manifest(path)
def test_sixth_backend_registers_without_core_changes(tmp_path):
register_backend_contract("test_plugin_backend",lambda spec: None,replace=True)
path=tmp_path/"plugin.yaml"
path.write_text("thing:\n backend: test_plugin_backend\n params: {quality: 2}\n")
assert load_manifest(path).assets[0].spec.backend=="test_plugin_backend"