fix(readback-timeout): fix monkeypatch for readback timeout; closes #140
This commit is contained in:
@@ -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)
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user