-
Notifications
You must be signed in to change notification settings - Fork 25
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
Simplify ad standard det tests #592
Conversation
…actory with mock put callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, nice way of simplifying: is this intended to close #262 or is it just a step in that direction?
There's a couple of type-checking bits that might be useful sanity checks [PathProvider is Callable[[str | None], Path]
; ad_standard_det_factory is a Callable[[type[T], int], T]
, but I think the Pytest Fixtures are making is clear what's being passed: just if we want to strict pyright this module I think they'll need the hints?
tests/epics/conftest.py
Outdated
set_mock_value(test_adstandard_det.hdf.file_path_exists, True) | ||
set_mock_value( | ||
test_adstandard_det.hdf.full_file_name, | ||
f"{value}/{static_path_provider._filename_provider()}.h5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f"{value}/{static_path_provider._filename_provider()}.h5", | |
f"{value}/{static_path_provider._filename_provider(test_adstandard_det.name)}.h5", |
nit: if we ever start using the value of the device name in the static_path_provider
@@ -110,7 +97,7 @@ async def _trigger( | |||
|
|||
|
|||
async def test_hints_from_hdf_writer(test_adpilatus: adpilatus.PilatusDetector): | |||
assert test_adpilatus.hints == {"fields": ["test_adpilatus"]} | |||
assert test_adpilatus.hints == {"fields": ["test_adpilatus1"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert test_adpilatus.hints == {"fields": ["test_adpilatus1"]} | |
assert test_adpilatus.hints == {"fields": [test_adpilatus.name]} |
nit: I think the important check here is that the hinted field for the hdfwriter comes from the device name
Mostly just a step in that direction - I think the tests can be further simplified by just paramterizing over the different standard detector classes, leaving just the tests for the individual controllers. But I'll leave that for another PR since this one is already fairly broad. |
* Refactor ADPilatus tests to use the ad_standard_det_factory * Add default signals for sim detector config * Fix type annotation * Overhaul sim detector tests to use ad standard det factory, improve factory with mock put callback * Fix tests for remaining detectors to account for new changes to factory fixture * Make sure to include config_sigs passed to init * Add suggestions from review
Significantly simplifies tests for ADPilatus and ADSimDetector to use ad_standard_det_factory fixture. Moves some of the mock callback logic to the fixture to simplify other tests as well.