Skip to content

Fix flakey undulator dcm test - #2142

Open
oliwenmandiamond wants to merge 19 commits into
mainfrom
fix_flakey_undulator_dcm_test
Open

Fix flakey undulator dcm test#2142
oliwenmandiamond wants to merge 19 commits into
mainfrom
fix_flakey_undulator_dcm_test

Conversation

@oliwenmandiamond

@oliwenmandiamond oliwenmandiamond commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #2141

Have verified that it is no longer flakey using the event_loop_fuzzing fixture and ran 100 times and all passed as shown below

image

Instructions to reviewer on how to test:

  1. Check new test makes sense

Checks for reviewer

  • Would the PR title make sense to a scientist on a set of release notes
  • If a new device has been added does it follow the standards
  • If changing the API for a pre-existing device, ensure that any beamlines using this device have updated their Bluesky plans accordingly
  • Have the connection tests for the relevant beamline(s) been run via dodal connect ${BEAMLINE}

oliwenmandiamond and others added 18 commits July 17, 2026 10:25
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
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
…LightSource/dodal into update_to_ophyd_async_0_20
@oliwenmandiamond
oliwenmandiamond requested a review from a team as a code owner July 29, 2026 09:54
@oliwenmandiamond
oliwenmandiamond changed the base branch from main to update_to_ophyd_async_0_20 July 29, 2026 09:55
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.16%. Comparing base (c5a4fc3) to head (cc4c9c8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2142   +/-   ##
=======================================
  Coverage   99.16%   99.16%           
=======================================
  Files         354      354           
  Lines       13848    13848           
=======================================
  Hits        13732    13732           
  Misses        116      116           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from update_to_ophyd_async_0_20 to main July 29, 2026 13:22
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.

Undulator DCM has flakey test

2 participants