Add test to ensure all functions in beamline modules are devices or fixtures#1984
Draft
Add test to ensure all functions in beamline modules are devices or fixtures#1984
Conversation
Contributor
|
This fails due to i23 def _is_i23_machine():
"""Devices using PVA can only connect from i23 machines, due to the absence of
PVA gateways at present.
"""
hostname = get_hostname()
return hostname.startswith("i23-ws") or hostname.startswith("i23-control")
@devices.factory(skip=lambda: not _is_i23_machine())
def oav_pin_tip_detection() -> PinTipDetection:
return PinTipDetection(
f"{PREFIX.beamline_prefix}-DI-OAV-01:",
"pin_tip_detection",
)So there does seem to be a use case for defining functions in the beamline module that aren't decorated. The only solution to this is to move this function and have it be imported instead dodal/devices/beamlines/i23/utils -> is_i23_machine() i23.py from dodal.devices.beamlines.i23 import is_i23_machine
@devices.factory(skip=lambda: not _is_i23_machine())
def oav_pin_tip_detection() -> PinTipDetection:
return PinTipDetection(
f"{PREFIX.beamline_prefix}-DI-OAV-01:",
"pin_tip_detection",
) |
DominicOram
reviewed
Mar 30, 2026
Contributor
DominicOram
left a comment
There was a problem hiding this comment.
I was going to suggest moving the i23 helper function to utils but on looking at it again I believe it should actually be entirely removed as it will mean thinks won't connect on the beamline cluster, where we should generally be running.
tpoliaw
reviewed
Mar 30, 2026
|
|
||
| def func_is_device(func) -> bool: | ||
| return hasattr(func, "_devices_decorator") | ||
|
|
Contributor
There was a problem hiding this comment.
Where is "_devices_decorator" coming from?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1981
Instructions to reviewer on how to test:
Checks for reviewer
dodal connect ${BEAMLINE}