Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pydantic
from bluesky.utils import MsgGenerator
from dodal.common import inject
from dodal.devices.beamlines.i15_1.laue import LaueMonochrometer
from dodal.devices.beamlines.i15_1.robot import Robot
from dodal.devices.tetramm import TetrammDetector
from dodal.devices.zebra.zebra import Zebra
Expand All @@ -25,6 +26,7 @@ class GenericCollectionDevices:
robot: Robot
tth: Motor
fast_shutter: ZebraFastShutter
xtal: LaueMonochrometer


def generic_collection(
Expand All @@ -46,7 +48,7 @@ def generic_collection(
baseline_devices (list[StandardReadable] | None, optional): Any other devices to
record metadata from. Defaults to None.
"""
DEFAULT_BASELINE_DEVICES = [devices.robot.spinner, devices.tth]
DEFAULT_BASELINE_DEVICES = [devices.robot.spinner, devices.tth, devices.xtal]
TIME_BETWEEN_FRAMES = 0.1
I0_DEADTIME = 0.0001

Expand Down
12 changes: 11 additions & 1 deletion tests/unit_tests/i15_1/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import pytest
from bluesky import RunEngine
from daq_config_server import ConfigClient
from dodal.devices.beamlines.i15_1.laue import LaueMonochrometer
from dodal.devices.beamlines.i15_1.robot import Robot
from dodal.devices.motors import XYZStage
from dodal.devices.tetramm import TetrammDetector
Expand Down Expand Up @@ -89,6 +91,13 @@ async def hexapod() -> XYZStage:
return hexapod


@pytest.fixture
async def xtal() -> LaueMonochrometer:
async with init_devices(mock=True):
xtal = LaueMonochrometer("", ConfigClient(""), "")
return xtal


@pytest.fixture
async def common_collection_devices(
eiger: EigerDetector,
Expand All @@ -97,5 +106,6 @@ async def common_collection_devices(
robot: Robot,
tth: Motor,
fast_shutter: ZebraFastShutter,
xtal: LaueMonochrometer,
) -> GenericCollectionDevices:
return GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter)
return GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter, xtal)
8 changes: 8 additions & 0 deletions tests/unit_tests/i15_1/test_centre_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def test_centre_sample_plan_makes_expected_calls(
msgs,
predicate=lambda msg: msg.command == "read" and msg.obj.name == "tth",
)
msgs = assert_message_and_return_remaining(
msgs,
predicate=lambda msg: msg.command == "read" and msg.obj.name == "xtal",
)
msgs = assert_message_and_return_remaining(
msgs,
predicate=lambda msg: (
Expand Down Expand Up @@ -165,6 +169,10 @@ def test_centre_sample_plan_makes_expected_calls(
msgs,
predicate=lambda msg: msg.command == "read" and msg.obj.name == "tth",
)
msgs = assert_message_and_return_remaining(
msgs,
predicate=lambda msg: msg.command == "read" and msg.obj.name == "xtal",
)
msgs = assert_message_and_return_remaining(
msgs,
predicate=lambda msg: msg.command == "close_run",
Expand Down
15 changes: 13 additions & 2 deletions tests/unit_tests/i15_1/test_static_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest
from bluesky.run_engine import RunEngine
from bluesky.simulators import RunEngineSimulator, assert_message_and_return_remaining
from dodal.devices.beamlines.i15_1.laue import LaueMonochrometer
from dodal.devices.beamlines.i15_1.robot import Robot
from dodal.devices.tetramm import TetrammDetector
from dodal.devices.zebra.zebra import Zebra
Expand Down Expand Up @@ -62,6 +63,10 @@ def test_static_collection_plan_makes_expected_calls(
msgs,
predicate=lambda msg: msg.command == "read" and msg.obj.name == "tth",
)
msgs = assert_message_and_return_remaining(
msgs,
predicate=lambda msg: msg.command == "read" and msg.obj.name == "xtal",
)
msgs = assert_message_and_return_remaining(
msgs,
predicate=lambda msg: (
Expand Down Expand Up @@ -121,6 +126,10 @@ def test_static_collection_plan_makes_expected_calls(
msgs,
predicate=lambda msg: msg.command == "read" and msg.obj.name == "tth",
)
msgs = assert_message_and_return_remaining(
msgs,
predicate=lambda msg: msg.command == "read" and msg.obj.name == "xtal",
)
msgs = assert_message_and_return_remaining(
msgs,
predicate=lambda msg: msg.command == "close_run",
Expand Down Expand Up @@ -194,8 +203,9 @@ async def test_given_plan_throws_exception_then_shutters_closed(
tth: Motor,
fast_shutter: ZebraFastShutter,
run_engine: RunEngine,
xtal: LaueMonochrometer,
):
devices = GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter)
devices = GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter, xtal)
run_engine = RunEngine()

zebra.inputs.soft_in_1.set = AsyncMock(ValueError)
Expand All @@ -217,8 +227,9 @@ def test_if_plan_fails_during_trigger_then_soft_in_cleaned_up(
robot: Robot,
tth: Motor,
fast_shutter: ZebraFastShutter,
xtal: LaueMonochrometer,
):
devices = GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter)
devices = GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter, xtal)

run_engine = RunEngineSimulator()

Expand Down
Loading