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

Commit

Permalink
(#836) Fix rotation cleanup test
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicOram committed Aug 7, 2023
1 parent 4ee4e97 commit 3604bef
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/artemis/experiment_plans/tests/test_rotation_scan_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,17 +406,25 @@ def test_cleanup_happens(
attenuator: Attenuator,
mock_rotation_subscriptions: RotationCallbackCollection,
):
class MyTestException(Exception):
pass

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

# check main subplan part fails
with pytest.raises(Exception):
with pytest.raises(MyTestException):
RE(
rotation_scan_plan(
test_rotation_params, smargon, zebra, backlight, detector_motion
test_rotation_params,
smargon,
zebra,
backlight,
attenuator,
detector_motion,
)
)
cleanup_plan.assert_not_called()
Expand All @@ -433,7 +441,7 @@ def test_cleanup_happens(
lambda _: mock_rotation_subscriptions,
),
):
with pytest.raises(Exception) as exc:
with pytest.raises(MyTestException) as exc:
RE(
get_plan(
test_rotation_params,
Expand Down

0 comments on commit 3604bef

Please sign in to comment.