MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / test_on_shutdown_persists_state

Function test_on_shutdown_persists_state

tests/test_v2_lifecycle.py:29–47  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

27
28
29def test_on_shutdown_persists_state(tmp_path):
30 _reset_lifecycle()
31 lc.on_startup(tmp_path)
32 # Record some activity
33 lc.on_route_complete(
34 request_id="test_1", tier_id=0, model="deepseek",
35 method="direct", confidence=0.8,
36 signal_a_tier=0, signal_a_conf=0.8,
37 signal_b_tier=1, signal_b_conf=0.7,
38 signal_c_tier=0, signal_c_conf=0.8,
39 )
40 lc.on_shutdown()
41 # Verify state file exists and is valid
42 state_file = tmp_path / "learned_state.json"
43 assert state_file.exists()
44 data = json.loads(state_file.read_text())
45 assert "signal_weights" in data
46 assert data["schema_version"] == 1
47 _reset_lifecycle()
48
49
50def test_on_route_complete_records_metrics(tmp_path):

Callers

nothing calls this directly

Calls 1

_reset_lifecycleFunction · 0.85

Tested by

no test coverage detected