Skip to content

Commit 6b5db05

Browse files
kingpanther13claude
andcommitted
test(screenshot): avoid bare await statements in the guard tests
CodeQL's py/ineffectual-statement flagged `await pending` and `await task` as statements with no effect: it does not model an await of a bare name as side-effecting, only an await of a call. Both now bind or assert on the result, which is also a stronger test -- take_snapshot returning None is asserted rather than assumed. This is the CodeQL Code Quality (python) gate failure on the previous head. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Nm7tyA1nfxNCWFXaR3AxV
1 parent 39c05a1 commit 6b5db05

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/src/unit/test_dashboard_screenshot_theme_guard.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,9 @@ async def test_overlapping_batches_are_serialized_per_engine_user(self) -> None:
538538

539539
_FakeWsClient.user_data[THEME_USER_DATA_KEY] = dict(_CLOBBERED_THEME)
540540
await first.restore()
541-
await pending
541+
# Bound to a name: a bare `await <name>` statement is what CodeQL's
542+
# py/ineffectual-statement flags.
543+
assert await pending is None
542544
await second.restore()
543545

544546
assert _FakeWsClient.user_data[THEME_USER_DATA_KEY] == _DARK_THEME
@@ -602,7 +604,7 @@ async def hang(_ws: Any) -> Any:
602604
await asyncio.wait_for(started.wait(), timeout=1)
603605
task.cancel()
604606
with pytest.raises(asyncio.CancelledError):
605-
await task
607+
_ = await task
606608

607609
_FakeWsClient.user_data[THEME_USER_DATA_KEY] = dict(_DARK_THEME)
608610
other = ThemeGuard.for_capture(_PUPPET_CREDENTIAL, None)

0 commit comments

Comments
 (0)