Skip to content

Commit

Permalink
exit some tests early
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-dot committed Sep 20, 2024
1 parent ded7cb9 commit 9cfc9bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/dodal/common/beamlines/device_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,15 @@ def __call__(
mock = mock or self._config.mock
timeout = timeout or self._config.timeout

fake_with_ophyd_sim: object | None = kwargs.pop("fake_with_ophyd_sim")
assert isinstance(
fake_with_ophyd_sim, bool | None
), "fake_with_ophyd_sim must be a boolean"
mock = fake_with_ophyd_sim or mock
# the instantiation of the device
try:
fake_with_ophyd_sim: object | None = kwargs.pop("fake_with_ophyd_sim")
assert isinstance(
fake_with_ophyd_sim, bool | None
), "fake_with_ophyd_sim must be a boolean"
mock = fake_with_ophyd_sim or mock
# the instantiation of the device
except KeyError:
pass

device = self._factory(*args, **kwargs)
if name:
Expand Down
2 changes: 2 additions & 0 deletions tests/common/beamlines/test_device_instantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def test_devices_are_identical(RE, module_and_devices_for_beamline):
Ensures that for every beamline all device functions prevent duplicate instantiation.
"""
bl_mod, devices_a = module_and_devices_for_beamline
if bl_mod.BL == "i22":
pytest.skip("i22 uses the new setup")
devices_b, _ = make_all_devices(
bl_mod,
include_skipped=True,
Expand Down

0 comments on commit 9cfc9bc

Please sign in to comment.