Skip to content

Commit

Permalink
add tests for device init for i22
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-dot committed Aug 27, 2024
1 parent dc8d0bc commit cfe97bf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/dodal/beamlines/i22.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
set_directory_provider(directory_provider)


# d11 at p38, but disconnected
@skip_device(lambda: BL == _LAB_NAME)
def saxs(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> NXSasOAV | NXSasPilatus:
Expand Down
14 changes: 14 additions & 0 deletions tests/beamlines/unit_tests/test_i22.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from dodal.beamlines import i22
from dodal.common.beamlines import beamline_utils
from dodal.devices.i22.nxsas import NXSasPilatus


def test_list():
beamline_utils.clear_devices()
i22.synchrotron(wait_for_connection=False, fake_with_ophyd_sim=True)
saxs = i22.saxs(wait_for_connection=False, fake_with_ophyd_sim=True)
assert (
saxs.__class__ == NXSasPilatus
), f"Expected NXSasPilatus, got {saxs.__class__}"

assert beamline_utils.list_active_devices() == ["synchrotron", "saxs"]
13 changes: 13 additions & 0 deletions tests/beamlines/unit_tests/test_p38.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os

from dodal.common.beamlines import beamline_utils
from dodal.devices.i22.nxsas import NXSasOAV

os.environ["BEAMLINE"] = "p38"
from dodal.beamlines import i22


def test_devices_diff_when_in_lab():
beamline_utils.clear_devices()
saxs = i22.saxs(wait_for_connection=False, fake_with_ophyd_sim=True)
assert saxs.__class__ == NXSasOAV, f"Expected NXSasOav, got {saxs.__class__}"

0 comments on commit cfe97bf

Please sign in to comment.