Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Update for removed ROBOT_LOAD
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicOram committed Aug 21, 2024
1 parent 97bc173 commit 92509e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 47 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ install_requires =
ophyd-async >= 0.3a5
bluesky >= 1.13.0a4
blueapi >= 0.4.3-rc1
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@5d7ed608fa66d8937c62662633a309f1b345834d
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@be39aac2020879b1ac28bffaae5dea52b9fd3b00

[options.entry_points]
console_scripts =
Expand Down
43 changes: 6 additions & 37 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
)
from dodal.common.beamlines.beamline_utils import clear_devices
from dodal.devices.aperturescatterguard import (
ApertureFiveDimensionalLocation,
ApertureConfigData,
AperturePosition,
ApertureScatterguard,
ApertureScatterguardTolerances,
SingleAperturePosition,
)
from dodal.devices.attenuator import Attenuator
from dodal.devices.backlight import Backlight
Expand Down Expand Up @@ -186,7 +184,7 @@ def _pass_on_mock(value, **kwargs):


def patch_async_motor(
motor: Motor, initial_position=0, call_log: MagicMock | None = None
motor: Motor, initial_position: float = 0, call_log: MagicMock | None = None
):
set_mock_value(motor.user_setpoint, initial_position)
set_mock_value(motor.user_readback, initial_position)
Expand Down Expand Up @@ -451,45 +449,16 @@ def thawer(RE) -> Generator[Thawer, Any, Any]:


@pytest.fixture
def aperture_scatterguard(RE):
positions = {
AperturePosition.LARGE: SingleAperturePosition(
location=ApertureFiveDimensionalLocation(0, 1, 2, 3, 4),
name="Large",
GDA_name="LARGE_APERTURE",
radius_microns=100,
),
AperturePosition.MEDIUM: SingleAperturePosition(
location=ApertureFiveDimensionalLocation(5, 6, 2, 8, 9),
name="Medium",
GDA_name="MEDIUM_APERTURE",
radius_microns=50,
),
AperturePosition.SMALL: SingleAperturePosition(
location=ApertureFiveDimensionalLocation(10, 11, 2, 13, 14),
name="Small",
GDA_name="SMALL_APERTURE",
radius_microns=20,
),
AperturePosition.ROBOT_LOAD: SingleAperturePosition(
location=ApertureFiveDimensionalLocation(15, 16, 2, 18, 19),
name="Robot_load",
GDA_name="ROBOT_LOAD",
radius_microns=None,
),
}
def aperture_scatterguard(RE, beamline_parameters):
with patch(
"dodal.beamlines.i03.load_positions_from_beamline_parameters",
return_value=positions,
), patch(
"dodal.beamlines.i03.load_tolerances_from_beamline_params",
return_value=ApertureScatterguardTolerances(0.1, 0.1, 0.1, 0.1, 0.1),
"dodal.beamlines.i03.ApertureConfigData",
return_value=ApertureConfigData(beamline_parameters),
):
ap_sg = i03.aperture_scatterguard(fake_with_ophyd_sim=True)
with (
patch_async_motor(ap_sg._aperture.x),
patch_async_motor(ap_sg._aperture.y),
patch_async_motor(ap_sg._aperture.z, 2),
patch_async_motor(ap_sg._aperture.z, 15.8),
patch_async_motor(ap_sg._scatterguard.x),
patch_async_motor(ap_sg._scatterguard.y),
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
BEAMLINE_PARAMETER_PATHS,
GDABeamlineParameters,
)
from dodal.devices.aperturescatterguard import (
ApertureScatterguard,
load_positions_from_beamline_parameters,
load_tolerances_from_beamline_params,
)
from dodal.devices.aperturescatterguard import ApertureConfigData, ApertureScatterguard
from ophyd_async.core import DeviceCollector


Expand All @@ -18,8 +14,7 @@ def ap_sg():
ap_sg = ApertureScatterguard(
prefix="BL03S",
name="ap_sg",
loaded_positions=load_positions_from_beamline_parameters(params),
tolerances=load_tolerances_from_beamline_params(params),
configuration_data=ApertureConfigData(params),
)
return ap_sg

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import types
from pathlib import Path
from typing import Tuple
from unittest.mock import DEFAULT, MagicMock, call, patch
from unittest.mock import ANY, DEFAULT, MagicMock, call, patch

import bluesky.plan_stubs as bps
import bluesky.preprocessors as bpp
Expand Down Expand Up @@ -238,7 +238,7 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
"name": "Small",
"GDA_name": "SMALL_APERTURE",
"radius_microns": 20,
"location": (10, 11, 2, 13, 14),
"location": ANY,
}
fake_fgs_composite.s4_slit_gaps.xgap.user_readback.sim_put(xgap_test_value) # type: ignore
fake_fgs_composite.s4_slit_gaps.ygap.user_readback.sim_put(ygap_test_value) # type: ignore
Expand Down

0 comments on commit 92509e9

Please sign in to comment.