Update tests/test_utils_pvpreload.py
Run CI Tests / test (push) Successful in 1m6s

This commit is contained in:
2025-08-07 23:55:58 +02:00
parent 176883e896
commit 15e38e07aa
+18 -16
View File
@@ -24,20 +24,22 @@ from morbidissimo import MorIOC
# IOC simulation
@pytest.fixture(scope="module")
def epics_ioc():
from epics import ca
pvname = "TEST:PV1"
def ioc_thread():
value = 0.0
while True:
ca.put(pvname, value)
value += 1.0
time.sleep(0.1)
thread = threading.Thread(target=ioc_thread, daemon=True)
thread.start()
@pytest.fixture(scope="module", autouse=True)
def run_test_ioc():
def ioc():
with MorIOC("TEST") as mor:
mor.host(PV1=float, PV2=float, PV3=float, PV4=float)
while True:
mor.serve(
PV1=1.0,
PV2=2.0,
PV3=3.0,
PV4=4.0
)
time.sleep(0.1)
t = threading.Thread(target=ioc, daemon=True)
t.start()
time.sleep(1)
def configure_logzero_for_pytest(caplog):
@@ -175,8 +177,8 @@ def test_offload(tmp_path, caplog):
pvname_4 = "TEST:PV4"
# Create 2 PVs
pv_3 = epics.PV(pvname_3)
pv_4 = epics.PV(pvname_4)
pv_3 = get_pv(pvname_3, connect = True)
pv_4 = get_pv(pvname_4, connect = True)
# 3. Attente active de connexion
assert pv_3.wait_for_connection(timeout=2), "PV3 non connecté"