Skip to content

850 fix for exceptions being ignored in beamline unit tests - #868

Merged
rtuck99 merged 4 commits into
mainfrom
850_fix_for_exceptions_being_ignored_in_beamline_unit_tests
Oct 25, 2024
Merged

rtuck99 merged 4 commits into
mainfrom
850_fix_for_exceptions_being_ignored_in_beamline_unit_tests

Conversation

@rtuck99

@rtuck99 rtuck99 commented Oct 25, 2024

Copy link
Copy Markdown
Contributor

Fixes #850

Instructions to reviewer on how to test:

  1. Unit tests all pass

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}

@rtuck99
rtuck99 marked this pull request as ready for review October 25, 2024 10:18
@rtuck99
rtuck99 force-pushed the 850_fix_for_exceptions_being_ignored_in_beamline_unit_tests branch from 819f11b to 6cd0727 Compare October 25, 2024 10:23
@codecov

codecov Bot commented Oct 25, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.54%. Comparing base (a3a3cf6) to head (a912bfb).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #868   +/-   ##
=======================================
  Coverage   95.54%   95.54%           
=======================================
  Files         125      125           
  Lines        5343     5344    +1     
=======================================
+ Hits         5105     5106    +1     
  Misses        238      238           

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

@DiamondJoseph DiamondJoseph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit

Comment thread src/dodal/beamlines/p38.py Outdated
f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
wait_for_connection,
fake_with_ophyd_sim,
id_gap_lookup_table_path="SPECIFY_ME",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'd prefer that Undulator took as a default argument id_gap_lookup_table_path=os.devnull: on i22, p38, the undulator isn't used as a Movable, and i22.py is pointing to an empty file on the dls filesystem. This would give us an empty file that is available everywhere, and when a beamline wants to specify it they can.
(splitting the Undulator into a Movable impl and a non-movable impl again is another issue)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all this device instantiation stuff has taught us we need a general look at how we provide these lookup tables to devices anyway. The undulator is maybe an exceptional case to this where actually in some places it's not changed, maybe we should have a writable and a read-only undulator

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change it to os.devnull for now - I was basically looking here for someone to tell me what the correct path was

Comment thread src/dodal/devices/i22/dcm.py Outdated
prefix: str,
temperature_prefix: str,

@DiamondJoseph DiamondJoseph Oct 25, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I disagree with this- I assume it's done because device_instantiation wants a prefix arg: there's 2 prefixes here, motion gives context to what it does.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the downside of python having both named and positional parameters - you don't get to choose the parameter names of your functions if you want them to be called by a framework :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we should allow not forcing prefix but whilst the old instantiation method insists on it I think we have to have it

Comment thread src/dodal/beamlines/i04_1.py Outdated
f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
wait_for_connection,
fake_with_ophyd_sim,
id_gap_lookup_table_path="SPECIFY_ME",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just do #871. I'll do that separate to this PR though

@DominicOram DominicOram left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good, thanks. I agree that the SPECIFY_ME isn't great but I will make a new issue to holistically look at undulators

@fajinyuan

fajinyuan commented Oct 25, 2024 via email

Copy link
Copy Markdown
Contributor

@rtuck99
rtuck99 force-pushed the fix_to_prevent_dls_sw_being_referenced_in_unit_tests branch from 74a344a to 54c9f54 Compare October 25, 2024 15:41
Base automatically changed from fix_to_prevent_dls_sw_being_referenced_in_unit_tests to main October 25, 2024 15:46
@rtuck99
rtuck99 force-pushed the 850_fix_for_exceptions_being_ignored_in_beamline_unit_tests branch from 923a946 to 6bf0ab6 Compare October 25, 2024 15:56
@rtuck99
rtuck99 force-pushed the 850_fix_for_exceptions_being_ignored_in_beamline_unit_tests branch from 6bf0ab6 to a912bfb Compare October 25, 2024 16:01
@rtuck99
rtuck99 merged commit ff12610 into main Oct 25, 2024
@rtuck99
rtuck99 deleted the 850_fix_for_exceptions_being_ignored_in_beamline_unit_tests branch October 25, 2024 16:05
@DiamondJoseph

Copy link
Copy Markdown
Contributor

@fajinyuan not a silly question- p38 is being set up to match the i22 bluesky experience as much as possible, so p38 has a software-only dummy undulator so that it appears in data and can be used for processing.

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

4 participants