Skip to content

VisualizerCommandTests: type the send_command mock so assertions need no ignores#1158

Merged
BioCam merged 1 commit into
PyLabRobot:mainfrom
BioCam:visualizer-tests-wait-helper-typecheck
Jul 8, 2026
Merged

VisualizerCommandTests: type the send_command mock so assertions need no ignores#1158
BioCam merged 1 commit into
PyLabRobot:mainfrom
BioCam:visualizer-tests-wait-helper-typecheck

Conversation

@BioCam

@BioCam BioCam commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Main's type checking job currently reds on the _wait_for_event helper added in 274da63: mypy types self.vis.send_command as the original coroutine method, so .call_args is an attr-defined error.

Rather than adding another suppression, keep the AsyncMock in a typed attribute (self.send_command_mock) in asyncSetUp and route all assertions through it. This removes the five per-use type: ignore[attr-defined] comments in VisualizerCommandTests; only the inherent method-assign suppression on the monkeypatch line remains.

Verified locally: make typecheck clean over all 500 files, ruff format --check and ruff check --select I pass, all 22 visualizer tests pass.

🤖 Generated with Claude Code

…ed no ignores

Mypy types self.vis.send_command as the original coroutine method, so every
mock assertion needed a type: ignore[attr-defined] and the newly added
_wait_for_event helper broke typechecking on main. Keep the AsyncMock in a
typed attribute and assert through it; only the inherent method-assign
suppression on the monkeypatch line remains.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BioCam
BioCam merged commit 2056489 into PyLabRobot:main Jul 8, 2026
21 checks passed
@BioCam
BioCam deleted the visualizer-tests-wait-helper-typecheck branch July 8, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant