Update to ophyd-async v0.20.1 - #2122
Conversation
ophyd-async 0.20.1 adds set_mock_attr (in ophyd_async.core) and enforces that test code can no longer assign directly to attribute names that collide with bluesky protocol verbs (set, read, trigger, kickoff, complete, prepare, describe, check_value). Replace direct assignments like `signal.set = AsyncMock(...)` with `set_mock_attr(signal, "set", AsyncMock(...))` across the affected test files and fixtures. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EQPRwf3pUved4ihrBLPi1g
The set_mock_attr fixes in the previous commit cover every reserved-attr NameError that this autouse fixture was blanket-suppressing, so the mask is no longer needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EQPRwf3pUved4ihrBLPi1g
ophyd-async 0.20.1
|
set_mock_attr(device, "attr", mock) doesn't let pyright narrow device.attr to the mock's type, so later device.attr.assert_*() calls failed with reportAttributeAccessIssue. Capture set_mock_attr's return value (it returns the mock unchanged, per its own docstring) and assert on that instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EQPRwf3pUved4ihrBLPi1g
|
Fixed a pyright regression from the Generated by Claude Code |
…LightSource/dodal into update_to_ophyd_async_0_20
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2122 +/- ##
==========================================
- Coverage 99.16% 99.16% -0.01%
==========================================
Files 354 354
Lines 13849 13848 -1
==========================================
- Hits 13733 13732 -1
Misses 116 116 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
CI is fully green now — the "Standardise config client" merge (#2099) replaced the duplicate Generated by Claude Code |
DominicOram
left a comment
There was a problem hiding this comment.
Thanks, generally looks good. Just the one query
Relm-Arrowny
left a comment
There was a problem hiding this comment.
Looks good overall, just one small thing to address before merging!
Could you also add a note to the PR description outlining the changes?
Something like:
"Replaces Bluesky protected attribute assignment in tests with set_mock_attr"
user_readback defaulted to 0 and was never set to a distinct value, so the assertion trivially passed regardless of what stop() did. Set setpoint and readback to different values so the test actually checks that stop() resets the setpoint to the current readback. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EQPRwf3pUved4ihrBLPi1g
|
Addressed both review notes:
Generated by Claude Code |
…LightSource/dodal into update_to_ophyd_async_0_20
|
FYI: Generated by Claude Code |
Update to latest ophyd-async version v0.20.1.
Summary of changes
set_mock_attrInstructions to reviewer on how to test:
1.Check tests pass
2. Check AI conversions of setting mock bluesky verbs done correctly
Checks for reviewer
dodal connect ${BEAMLINE}