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

Commit

Permalink
Merge pull request #977 from DiamondLightSource/976_update_blueapi
Browse files Browse the repository at this point in the history
976 update blueapi
  • Loading branch information
dperl-dls authored Nov 14, 2023
2 parents 6b0b5df + e1a1795 commit 3ad94ff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package_dir =
install_requires =
bluesky
pyepics
blueapi==0.3.7
blueapi
flask-restful
zocalo
ispyb
Expand Down
24 changes: 18 additions & 6 deletions src/hyperion/experiment_plans/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ def test_rotation_params_nomove():


@pytest.fixture
def eiger():
return i03.eiger(fake_with_ophyd_sim=True)
def eiger(done_status):
eiger = i03.eiger(fake_with_ophyd_sim=True)
eiger.stage = MagicMock(return_value=done_status)
eiger.unstage = MagicMock(return_value=done_status)
return eiger


@pytest.fixture
Expand Down Expand Up @@ -190,15 +193,20 @@ def test_full_grid_scan_params():
return GridScanWithEdgeDetectInternalParameters(**params)


@pytest.fixture
def done_status():
s = Status()
s.set_finished()
return s


@pytest.fixture()
def fake_create_devices(
eiger: EigerDetector,
smargon: Smargon,
zebra: Zebra,
detector_motion: DetectorMotion,
):
eiger.stage = MagicMock()
eiger.unstage = MagicMock()
mock_omega_sets = MagicMock(return_value=Status(done=True, success=True))

mock_arm_disarm = MagicMock(
Expand Down Expand Up @@ -230,9 +238,8 @@ def fake_create_rotation_devices(
undulator: Undulator,
synchrotron: Synchrotron,
s4_slit_gaps: S4SlitGaps,
done_status,
):
eiger.stage = MagicMock()
eiger.unstage = MagicMock()
mock_omega_sets = MagicMock(return_value=Status(done=True, success=True))

mock_arm_disarm = MagicMock(
Expand Down Expand Up @@ -273,6 +280,8 @@ def fake_fgs_composite(smargon: Smargon, test_fgs_params: InternalParameters):
zebra=i03.zebra(fake_with_ophyd_sim=True),
)

fake_composite.eiger.stage = MagicMock(return_value=done_status)

fake_composite.aperture_scatterguard.aperture.x.user_setpoint._use_limits = False
fake_composite.aperture_scatterguard.aperture.y.user_setpoint._use_limits = False
fake_composite.aperture_scatterguard.aperture.z.user_setpoint._use_limits = False
Expand Down Expand Up @@ -300,6 +309,9 @@ def mock_subscriptions(test_fgs_params):
)
subscriptions.ispyb_handler.ispyb = MagicMock(spec=Store3DGridscanInIspyb)
subscriptions.ispyb_handler.ispyb.begin_deposition = lambda: [[0, 0], 0, 0]
subscriptions.ispyb_handler.active = True
subscriptions.nexus_handler.active = True
subscriptions.zocalo_handler.active = True

return subscriptions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,6 @@ def test_rotation_scan(
attenuator: Attenuator,
mock_rotation_subscriptions: RotationCallbackCollection,
):
eiger.stage = MagicMock()
eiger.unstage = MagicMock()
zebra.pc.arm.armed.set(False)
with (
patch("dodal.beamlines.i03.smargon", return_value=smargon),
Expand Down Expand Up @@ -447,8 +445,6 @@ def test_cleanup_happens(
class MyTestException(Exception):
pass

eiger.stage = MagicMock()
eiger.unstage = MagicMock()
smargon.omega.set = MagicMock(
side_effect=MyTestException("Experiment fails because this is a test")
)
Expand Down

0 comments on commit 3ad94ff

Please sign in to comment.