Skip to content

Commit 79265a2

Browse files
committed
Fix some tests
1 parent d013f62 commit 79265a2

File tree

2 files changed

+16
-34
lines changed

2 files changed

+16
-34
lines changed

src/dodal/plans/configure_arm_trigger_and_disarm_detector.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
)
1313
from ophyd_async.fastcs.eiger import EigerDetector
1414

15-
from dodal.beamlines.i03 import fastcs_eiger, set_path_provider
15+
from dodal.beamlines.i03 import fastcs_eiger
1616
from dodal.devices.detector import DetectorParams
1717
from dodal.log import LOGGER, do_default_logging_setup
1818

@@ -163,9 +163,7 @@ def set_mx_settings_pvs(
163163
PurePath("/dls/i03/data/2025/cm40607-2/test_new_eiger/"),
164164
)
165165

166-
set_path_provider(path_provider)
167-
168-
eiger = fastcs_eiger(connect_immediately=True)
166+
eiger = fastcs_eiger.build(connect_immediately=True, path_provider=path_provider)
169167
run_engine(
170168
configure_arm_trigger_and_disarm_detector(
171169
eiger=eiger,

tests/test_utils.py

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from bluesky.protocols import Readable
99
from ophyd_async.epics.motor import Motor
1010

11-
from dodal.beamlines import i03, i23
11+
from dodal.beamlines import i04, i23
1212
from dodal.devices.diamond_filter import DiamondFilter, I03Filters
1313
from dodal.utils import (
1414
AnyDevice,
@@ -313,7 +313,7 @@ def test_invalid_beamline_variable_causes_get_device_module_to_raise(bl):
313313
get_beamline_based_on_environment_variable()
314314

315315

316-
@pytest.mark.parametrize("bl,module", [("i03", i03), ("i23", i23)])
316+
@pytest.mark.parametrize("bl,module", [("i04", i04), ("i23", i23)])
317317
def test_valid_beamline_variable_causes_get_device_module_to_return_module(bl, module):
318318
with patch.dict(os.environ, {"BEAMLINE": bl}):
319319
assert get_beamline_based_on_environment_variable() == module
@@ -488,40 +488,24 @@ def test_is_v2_device_type(input: Any, expected_result: bool):
488488

489489

490490
def test_calling_factory_with_different_args_raises_an_exception():
491-
i03.undulator(daq_configuration_path=MOCK_DAQ_CONFIG_PATH)
491+
i04.oav(params=MagicMock())
492492
with pytest.raises(
493493
RuntimeError,
494494
match="Device factory method called multiple times with different parameters",
495495
):
496-
i03.undulator(daq_configuration_path=MOCK_DAQ_CONFIG_PATH + "x")
497-
i03.undulator.cache_clear()
496+
i04.oav(params=MagicMock())
497+
i04.oav.cache_clear()
498498

499499

500-
def test_calling_factory_with_different_args_does_not_raise_an_exception_after_cache_clear(
501-
alternate_config,
502-
):
503-
i03.undulator(daq_configuration_path=MOCK_DAQ_CONFIG_PATH)
504-
i03.undulator.cache_clear()
505-
i03.undulator(daq_configuration_path=alternate_config)
506-
i03.undulator.cache_clear()
507-
508-
509-
def test_factories_can_be_called_in_any_order(alternate_config):
510-
i03.undulator_dcm(daq_configuration_path=alternate_config)
511-
i03.undulator(daq_configuration_path=alternate_config)
512-
513-
i03.undulator_dcm.cache_clear()
514-
i03.undulator.cache_clear()
515-
516-
i03.undulator(daq_configuration_path=alternate_config)
517-
i03.undulator_dcm(daq_configuration_path=alternate_config)
518-
519-
i03.undulator.cache_clear()
520-
i03.undulator_dcm.cache_clear()
500+
def test_calling_factory_with_different_args_does_not_raise_an_exception_after_cache_clear():
501+
i04.oav(params=MagicMock())
502+
i04.oav.cache_clear()
503+
i04.oav(params=MagicMock())
504+
i04.oav.cache_clear()
521505

522506

523-
def test_factory_calls_are_cached(alternate_config):
524-
undulator1 = i03.undulator(daq_configuration_path=alternate_config)
525-
undulator2 = i03.undulator(daq_configuration_path=alternate_config)
507+
def test_factory_calls_are_cached():
508+
undulator1 = i04.undulator()
509+
undulator2 = i04.undulator()
526510
assert undulator1 is undulator2
527-
i03.undulator.cache_clear()
511+
i04.undulator.cache_clear()

0 commit comments

Comments
 (0)