From 39d001aaccc68b404dd9e1020122e286ce465c50 Mon Sep 17 00:00:00 2001 From: tligui_y Date: Fri, 8 Aug 2025 01:13:00 +0200 Subject: [PATCH] Update tests/test_utils_pv.py --- tests/test_utils_pv.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/test_utils_pv.py b/tests/test_utils_pv.py index d238028a4..d9762033a 100644 --- a/tests/test_utils_pv.py +++ b/tests/test_utils_pv.py @@ -14,20 +14,24 @@ from morbidissimo import MorIOC def morioc_server(): def run_ioc(): with MorIOC("TEST") as mor: - val = 0.0 + # Initialisation explicite à 0.0 + current_val = 0.0 + mor.host(VAL=float) + while True: - mor.host(VAL=float) + # Vérifie les nouvelles valeurs input_val = mor.get("VAL") if input_val is not None: - val = input_val - mor.serve(VAL=val) + current_val = input_val + + # Sert la valeur actuelle + mor.serve(VAL=current_val) time.sleep(0.1) thread = threading.Thread(target=run_ioc, daemon=True) thread.start() - time.sleep(1) # attendre que le serveur soit prêt - - yield # le thread tourne en fond + time.sleep(1) # Attend que le serveur soit prêt + yield # === Utils === @pytest.fixture @@ -100,12 +104,8 @@ def test_put_with_progress_and_repr(value_new, value_before, expected_color): assert all(f"{value_new}" in line for line in printed_lines), "new value not in all lines" assert all(f"{value_before}" in line for line in printed_lines), "old value not in all lines" - # Vérifie que la valeur finale est correcte - assert pv.get() == pytest.approx(value_new) - - # Représentation - expected_repr = f'PV "TEST:VAL" at {value_new} ' + assert pv.get() == value_new def test_use_callback_context_manager(): pv = PV("TEST:VAL", connection_timeout=2.0) @@ -149,14 +149,17 @@ def test_orig_repr_is_not_custom_repr(): assert original.startswith("