diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index cfe52ea..0000000 --- a/tests/conftest.py +++ /dev/null @@ -1,14 +0,0 @@ -""" -Conftest runs for all tests in this directory and subdirectories. Thereby, we know for -certain that the SocketSignal.READBACK_TIMEOUT is set to 0 for all tests, which prevents -hanging tests when a readback is attempted on a non-connected socket. -""" - -# conftest.py -import pytest -from ophyd_devices.utils.socket import SocketSignal - - -@pytest.fixture(autouse=True) -def patch_socket_timeout(monkeypatch): - monkeypatch.setattr(SocketSignal, "READBACK_TIMEOUT", 0.0) diff --git a/tests/tests_devices/test_fupr_ophyd.py b/tests/tests_devices/test_fupr_ophyd.py index 2683a14..9e56856 100644 --- a/tests/tests_devices/test_fupr_ophyd.py +++ b/tests/tests_devices/test_fupr_ophyd.py @@ -2,6 +2,7 @@ from unittest import mock import pytest from ophyd_devices.tests.utils import SocketMock +from ophyd_devices.utils.socket import SocketSignal from csaxs_bec.devices.omny.galil.fupr_ophyd import FuprGalilController, FuprGalilMotor @@ -17,6 +18,11 @@ def fsamroy(dm_with_devices): socket_cls=SocketMock, device_manager=dm_with_devices, ) + for walk in fsamroy_motor.walk_signals(): + if isinstance(walk.item, SocketSignal): + walk.item._readback_timeout = ( + 0.0 # Set the readback timeout to 0 to avoid waiting during tests + ) fsamroy_motor.controller.on() assert isinstance(fsamroy_motor.controller, FuprGalilController) yield fsamroy_motor