Skip to content

Commit

Permalink
Dodal 846 device factory support for ophyd v1 (#743)
Browse files Browse the repository at this point in the history
* Convert eiger to device_factory
  • Loading branch information
rtuck99 authored Jan 30, 2025
1 parent e31c703 commit adc54b2
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies = [
"ophyd == 1.9.0",
"ophyd-async >= 0.8a5",
"bluesky >= 1.13",
"dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@ae57c22eb170ef92ea9364541b63da30f6fbd52e",
"dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@709df016424e3a6776f839cc58993651c5c678ab",
]


Expand Down
2 changes: 1 addition & 1 deletion src/mx_bluesky/hyperion/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def plan():

def fake_create_rotation_devices():
beamstop = i03.beamstop(connect_immediately=True, mock=True)
eiger = i03.eiger(fake_with_ophyd_sim=True)
eiger = i03.eiger(connect_immediately=True, mock=True)
smargon = i03.smargon(connect_immediately=True, mock=True)
zebra = i03.zebra(connect_immediately=True, mock=True)
detector_motion = i03.detector_motion(connect_immediately=True, mock=True)
Expand Down
9 changes: 5 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def done_status():

@pytest.fixture
def eiger(done_status):
eiger = i03.eiger(fake_with_ophyd_sim=True)
eiger = i03.eiger(connect_immediately=True, mock=True)
eiger.stage = MagicMock(return_value=done_status)
eiger.do_arm.set = MagicMock(return_value=done_status)
eiger.unstage = MagicMock(return_value=done_status)
Expand Down Expand Up @@ -382,7 +382,7 @@ def undulator():


@pytest.fixture
def s4_slit_gaps():
def s4_slit_gaps() -> S4SlitGaps:
return i03.s4_slit_gaps(connect_immediately=True, mock=True)


Expand Down Expand Up @@ -817,19 +817,20 @@ async def fake_fgs_composite(
dcm,
panda,
backlight,
s4_slit_gaps,
):
fake_composite = FlyScanXRayCentreComposite(
aperture_scatterguard=aperture_scatterguard,
attenuator=attenuator,
backlight=backlight,
dcm=dcm,
# We don't use the eiger fixture here because .unstage() is used in some tests
eiger=i03.eiger(fake_with_ophyd_sim=True),
eiger=i03.eiger(connect_immediately=True, mock=True),
zebra_fast_grid_scan=i03.zebra_fast_grid_scan(
connect_immediately=True, mock=True
),
flux=i03.flux(connect_immediately=True, mock=True),
s4_slit_gaps=i03.s4_slit_gaps(connect_immediately=True, mock=True),
s4_slit_gaps=s4_slit_gaps,
smargon=smargon,
undulator=i03.undulator(connect_immediately=True, mock=True),
synchrotron=synchrotron,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def fxc_composite():
dcm=i03.dcm(fake_with_ophyd_sim=True),
eiger=i03.eiger(),
zebra_fast_grid_scan=i03.zebra_fast_grid_scan(),
flux=i03.flux(fake_with_ophyd_sim=True),
flux=i03.flux(connect_immediately=True, mock=True),
robot=i03.robot(connect_immediately=True, mock=True),
panda=i03.panda(connect_immediately=True, mock=True),
panda_fast_grid_scan=i03.panda_fast_grid_scan(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async def test_getting_data_for_ispyb():
synchrotron = i03.synchrotron(connect_immediately=True, mock=True)
slit_gaps = S4SlitGaps(f"{CONST.SIM.BEAMLINE}-AL-SLITS-04:", name="slits")
attenuator = i03.attenuator(connect_immediately=True, mock=True)
flux = i03.flux(fake_with_ophyd_sim=True)
flux = i03.flux(connect_immediately=True, mock=True)
dcm = i03.dcm(fake_with_ophyd_sim=True)
aperture_scatterguard = ApertureScatterguard(
prefix="BL03S",
Expand All @@ -41,7 +41,7 @@ async def test_getting_data_for_ispyb():
tolerances=AperturePosition.tolerances_from_gda_params(params),
)
smargon = i03.smargon(connect_immediately=True, mock=True)
eiger = i03.eiger(fake_with_ophyd_sim=True)
eiger = i03.eiger(mock=True)
await undulator.connect()
await slit_gaps.connect()
await flux.connect()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@pytest.fixture
def fake_eiger() -> EigerDetector:
return eiger(fake_with_ophyd_sim=True)
return eiger(mock=True)


def test_read_hardware_for_zocalo_in_RE(fake_eiger, RE: RunEngine):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/common/plan_stubs/test_do_fgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def fgs_devices(RE):
grid_scan_device = ZebraFastGridScan("zebra_fgs")

# Eiger done separately as not ophyd-async yet
detector = eiger(fake_with_ophyd_sim=True)
detector = eiger(mock=True)

return {
"synchrotron": synchrotron,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/hyperion/device_setup_plans/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@pytest.fixture()
def mock_eiger():
eiger = i03.eiger(fake_with_ophyd_sim=True)
eiger = i03.eiger(mock=True)
eiger.detector_params = MagicMock()
eiger.async_stage = MagicMock()
eiger.disarm_detector = MagicMock()
Expand Down

0 comments on commit adc54b2

Please sign in to comment.