fix: stop masking runtime failures

This commit is contained in:
chengyongru
2026-07-21 11:44:52 +08:00
committed by chengyongru
parent afc65c086e
commit dfc3919b52
22 changed files with 446 additions and 300 deletions
+15
View File
@@ -34,6 +34,21 @@ DYNAMIC_PROVIDER_NAME = "my-company-api"
DYNAMIC_PROVIDER_API_BASE = "https://example.test/v1"
def test_settings_payload_propagates_preset_resolution_failure(
monkeypatch: pytest.MonkeyPatch,
) -> None:
config = Config()
monkeypatch.setattr("nanobot.webui.settings_api.load_config", lambda: config)
monkeypatch.setattr(
Config,
"resolve_preset",
lambda _self: (_ for _ in ()).throw(RuntimeError("invalid preset")),
)
with pytest.raises(RuntimeError, match="invalid preset"):
settings_payload()
def test_docs_version_uses_released_versions_and_falls_back_for_dev() -> None:
assert _docs_version("0.2.3") == "0.2.3"
assert _docs_version("0.2.3.post1") == "0.2.3.post1"