Files
EvoScientist-Multi/tests/test_host_metering_extensions.py
T
m4 5a581c78a2
Build / build (push) Has been cancelled
Docker / build (push) Has been cancelled
Lint / ruff (push) Has been cancelled
Test / pytest (ubuntu-latest, 3.11) (push) Has been cancelled
Test / pytest (ubuntu-latest, 3.12) (push) Has been cancelled
Test / pytest (windows-latest, 3.11) (push) Has been cancelled
Test / pytest (windows-latest, 3.12) (push) Has been cancelled
feat: add scoped model runtime configuration
Introduce provider, model, and invocation contracts with encrypted configuration persistence. Add web runtime fencing, route fallback, recovery middleware, workspace scoping, and comprehensive tests.
2026-08-14 22:03:04 +08:00

36 lines
1.2 KiB
Python

from EvoScientist.llm.errors import AgentControlError
from EvoScientist.middleware.model_fallback import _is_non_fallbackable
from EvoScientist.middleware.recoverable_metering import _metering_config, _source_type
def test_agent_control_error_is_non_fallbackable():
error = AgentControlError(
"INSUFFICIENT_BALANCE",
"balance unavailable",
status_code=403,
)
assert "platform control error" in (_is_non_fallbackable(error) or "")
assert error.model_dump()["code"] == "INSUFFICIENT_BALANCE"
def test_recoverable_metering_reads_explicit_evomemory_scope():
metering = _metering_config(
{
"configurable": {
"ai4sci_metering": {
"gateway_url": "http://gateway",
"run_id": "run-parent",
"envelope_signature": "signed-parent",
"source_type": "evomemory_linker",
}
}
}
)
assert metering is not None
assert metering["source_type"] == "evomemory_linker"
assert _source_type({"metering_scope": "evomemory_subagent_worker"}, []) == (
"evomemory_subagent_worker"
)