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

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

Merged

Conversation

rtuck99
Copy link
Contributor

@rtuck99 rtuck99 commented Oct 25, 2024

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
Copy link

codecov bot commented Oct 25, 2024

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.

Copy link
Contributor

@DiamondJoseph DiamondJoseph left a comment

Choose a reason for hiding this comment

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

Just a nit

@@ -253,6 +252,7 @@ def undulator(
f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
wait_for_connection,
fake_with_ophyd_sim,
id_gap_lookup_table_path="SPECIFY_ME",
Copy link
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
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
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

prefix: str,
temperature_prefix: str,
Copy link
Contributor

@DiamondJoseph DiamondJoseph Oct 25, 2024

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
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
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

@@ -123,6 +123,7 @@ def undulator(
f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
wait_for_connection,
fake_with_ophyd_sim,
id_gap_lookup_table_path="SPECIFY_ME",
Copy link
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

Copy link
Contributor

@DominicOram DominicOram left a comment

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
Copy link

fajinyuan commented Oct 25, 2024 via email

@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
19 checks passed
@rtuck99 rtuck99 deleted the 850_fix_for_exceptions_being_ignored_in_beamline_unit_tests branch October 25, 2024 16:05
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