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

Read aperture properly rather than private method #506

Merged
merged 8 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies = [
"ophyd == 1.9.0",
"ophyd-async >= 0.3a5",
"bluesky >= 1.13.0a4",
"dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@db42ad951155ba2cfd7574d3b5452c9bf975bfcf",
"dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@main",
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,12 @@ async def test_full_rotation_plan_smargon_settings(

async def test_rotation_plan_moves_aperture_correctly(
run_full_rotation_plan: RotationScanComposite,
test_rotation_params: RotationScan,
) -> None:
aperture_scatterguard: ApertureScatterguard = (
run_full_rotation_plan.aperture_scatterguard
)
assert (
await aperture_scatterguard.get_current_aperture_position()
== ApertureValue.SMALL
await aperture_scatterguard.selected_aperture.get_value() == ApertureValue.SMALL
Copy link
Contributor

Choose a reason for hiding this comment

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

selected_aperture is the sole HintedSignal of aperture_scatterguard, you should be able to just aperture_scatterguard.read()?

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'm not sure I see the advantage of this as it's more verbose and now makes the test depend on the fact the signal is hinted but don't care so much so have changed it. Are you suggesting it because read() is the more externally facing API over get_value()?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the change to the test I think I was just wrong? I thought that
selected_aperture.read() == ApertureValue.SMALL

And then we could ensure that the selected_aperture was always readable and always gave the ApertureValue as its output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yh, I think even reading the one signal it will still return a dict with the name and value.

But the test shouldn't care if it's readable or hinted. The test is "does doing this plan change the aperture in the expected way". We have other tests that are "can I read the selected aperture in the way I expect" like

"aperture_scatterguard-selected_aperture": ApertureValue.SMALL,

)


Expand Down
Loading