@@ -37,7 +37,8 @@ async def on_tool_end(self, ctx: Any, agent: Any, tool: Any, result: Any) -> Non
3737def test_bridge_emits_envelope_and_name ():
3838 hooks = _RecordingHooks ()
3939 asyncio .run (bridge_copilot_tool_event (ToolEnd (tool_name = "echo" , text = "hi" ), hooks ))
40- assert len (hooks .starts ) == 1 and hooks .starts [0 ][2 ].name == "echo"
40+ assert len (hooks .starts ) == 1
41+ assert hooks .starts [0 ][2 ].name == "echo"
4142 assert len (hooks .ends ) == 1
4243 _ , _ , tool , payload = hooks .ends [0 ]
4344 assert tool .name == "echo"
@@ -93,13 +94,14 @@ async def _fake_render(text: str, **_kw: Any) -> None:
9394 _drive (backend , hooks )
9495
9596 assert "hi" in rendered
96- assert hooks .ends and json .loads (hooks .ends [0 ][3 ]) == {"text" : "r" }
97+ assert hooks .ends
98+ assert json .loads (hooks .ends [0 ][3 ]) == {"text" : "r" }
9799
98100
99101def test_drive_retries_then_succeeds_on_timeout (monkeypatch ):
100102 monkeypatch .setattr (
101103 "seclab_taskflow_agent._stream.render_model_output" ,
102- lambda * a , ** kw : _noop (),
104+ lambda * _a , ** _kw : _noop (),
103105 )
104106 backend = _ScriptedBackend ([BackendTimeoutError ("once" ), [TextDelta (text = "ok" )]])
105107 _drive (backend , max_api_retry = 2 )
@@ -109,7 +111,7 @@ def test_drive_retries_then_succeeds_on_timeout(monkeypatch):
109111def test_drive_raises_after_retries_exhausted (monkeypatch ):
110112 monkeypatch .setattr (
111113 "seclab_taskflow_agent._stream.render_model_output" ,
112- lambda * a , ** kw : _noop (),
114+ lambda * _a , ** _kw : _noop (),
113115 )
114116 backend = _ScriptedBackend ([BackendTimeoutError ("a" ), BackendTimeoutError ("b" )])
115117 with pytest .raises (BackendTimeoutError ):
@@ -119,7 +121,7 @@ def test_drive_raises_after_retries_exhausted(monkeypatch):
119121def test_drive_caps_rate_limit_backoff (monkeypatch ):
120122 monkeypatch .setattr (
121123 "seclab_taskflow_agent._stream.render_model_output" ,
122- lambda * a , ** kw : _noop (),
124+ lambda * _a , ** _kw : _noop (),
123125 )
124126 sleeps : list [float ] = []
125127
@@ -135,7 +137,8 @@ async def _fake_sleep(n: float) -> None:
135137 ]
136138 )
137139 _drive (backend , initial_rate_limit_backoff = 1 , max_rate_limit_backoff = 4 )
138- assert sleeps and all (s <= 4 for s in sleeps )
140+ assert sleeps
141+ assert all (s <= 4 for s in sleeps )
139142
140143
141144async def _noop () -> None :
@@ -156,7 +159,7 @@ async def run_streamed(self, _agent: Any, _prompt: str, *, max_turns: int) -> An
156159def test_drive_raises_on_stream_idle_timeout (monkeypatch ):
157160 monkeypatch .setattr (
158161 "seclab_taskflow_agent._stream.render_model_output" ,
159- lambda * a , ** kw : _noop (),
162+ lambda * _a , ** _kw : _noop (),
160163 )
161164 # Force a tiny idle timeout so the test runs quickly.
162165 monkeypatch .setattr ("seclab_taskflow_agent._stream.STREAM_IDLE_TIMEOUT" , 0.05 )
@@ -182,7 +185,7 @@ def test_drive_raises_on_stream_idle_timeout(monkeypatch):
182185def test_drive_pings_watchdog_per_event (monkeypatch ):
183186 monkeypatch .setattr (
184187 "seclab_taskflow_agent._stream.render_model_output" ,
185- lambda * a , ** kw : _noop (),
188+ lambda * _a , ** _kw : _noop (),
186189 )
187190 pings : list [int ] = []
188191 monkeypatch .setattr (
0 commit comments