Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch device creation exceptions in test_device_instantiation #851

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

callumforrester
Copy link
Contributor

Fixes #850

Instructions to reviewer on how to test:

  1. Run unit tests
  2. Break a device and confirm tests fail

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}

@callumforrester
Copy link
Contributor Author

Unsurprisingly, since these tests have been swallowing exceptions for 5 months, there are now previously hidden errors that we need to decide what to do about. Most of them seem to revolve around /dls_sw not being available in the CI environment, which I think is fair, our device instantiation tests should be able to run without it. For one thing, it is down right now.

It appears this wasn't a problem previously because fake_with_ophyd_sim=True was being used to create fake ophyd device classes via ophyd.sim.make_fake_device, which strips out all of the logic from the ophyd device class and essentially makes a mock. Now many of those devices have been migrated to ophyd-async, whose mock feature only affects signal backends, not the logic in the class constructor/methods.

One fix I thought of was to make sure that /dls_sw is not accessed in any of the device constructors or connect methods, in which case test_device_instantation.py and dodal connect -s would never touch it, but I am open to alternatives. Tagging @DominicOram, @DiamondJoseph and @noemifrisina for opinions.

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.

I22 connection tests did not fail when they weren't mocking
1 participant