From 7f84f1b8a60239a30dbd267bfc35cf2a7f9c7ad0 Mon Sep 17 00:00:00 2001 From: tligui_y Date: Mon, 11 Aug 2025 00:43:45 +0200 Subject: [PATCH] Update tests/test_utils_pyepics.py --- tests/test_utils_pyepics.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_utils_pyepics.py b/tests/test_utils_pyepics.py index ca41645ee..795c483e4 100644 --- a/tests/test_utils_pyepics.py +++ b/tests/test_utils_pyepics.py @@ -35,37 +35,44 @@ def epics_ioc(): # ------------------------------------------------------------------------------ def test_enum_wrapper_initial_state(): enum = EnumWrapper("TEST_ENUM") + assert enum._pv.wait_for_connection(timeout=2.0), "PV non connecté" assert enum.get() == 0 assert enum.get_name() == "OFF" def test_enum_wrapper_set_valid_string(): enum = EnumWrapper("TEST_ENUM") + assert enum._pv.wait_for_connection(timeout=2.0), "PV non connecté" enum.set("ON") assert enum.get() == 1 assert enum.get_name() == "ON" def test_enum_wrapper_set_valid_index(): enum = EnumWrapper("TEST_ENUM") + assert enum._pv.wait_for_connection(timeout=2.0), "PV non connecté" enum.set(2) assert enum.get_name() == "STANDBY" def test_enum_wrapper_set_invalid_string_raises(): enum = EnumWrapper("TEST_ENUM") + assert enum._pv.wait_for_connection(timeout=2.0), "PV non connecté" with pytest.raises(AssertionError): enum.set("INVALID") def test_enum_wrapper_set_invalid_index_raises(): enum = EnumWrapper("TEST_ENUM") + assert enum._pv.wait_for_connection(timeout=2.0), "PV non connecté" with pytest.raises(AssertionError): enum.set(10) def test_enum_wrapper_set_negative_index_raises(): enum = EnumWrapper("TEST_ENUM") + assert enum._pv.wait_for_connection(timeout=2.0), "PV non connecté" with pytest.raises(AssertionError): enum.set(-1) def test_enum_wrapper_setters_property(): enum = EnumWrapper("TEST_ENUM") + assert enum._pv.wait_for_connection(timeout=2.0), "PV non connecté" setters = enum.setters setters.ON() assert enum.get_name() == "ON" @@ -75,11 +82,13 @@ def test_enum_wrapper_setters_property(): # ------------------------------------------------------------------------------ def test_monitor_accumulator_initial_state(): pv = PV("TEST_ANALOG") + assert pv._pv.wait_for_connection(timeout=2.0), "PV non connecté" monitor = MonitorAccumulator(pv) assert len(monitor.values) == 0 def test_monitor_accumulator_captures_values(): pv = PV("TEST_ANALOG") + assert pv._pv.wait_for_connection(timeout=2.0), "PV non connecté" monitor = MonitorAccumulator(pv) monitor.accumulate() @@ -91,6 +100,7 @@ def test_monitor_accumulator_captures_values(): def test_monitor_accumulator_cycle_clears_values(): pv = PV("TEST_ANALOG") + assert pv._pv.wait_for_connection(timeout=2.0), "PV non connecté" monitor = MonitorAccumulator(pv) monitor.accumulate() @@ -124,19 +134,23 @@ def test_positioner_handles_special_chars(): # ------------------------------------------------------------------------------ def test_epics_string_initial_value(): estr = EpicsString("TEST_STRING") + assert estr._pv.wait_for_connection(timeout=2.0), "PV non connecté" assert estr.get() == "default" def test_epics_string_set_value(): estr = EpicsString("TEST_STRING") + assert estr._pv.wait_for_connection(timeout=2.0), "PV non connecté" estr.set("new_value") assert estr.get() == "new_value" def test_epics_string_call_syntax(): estr = EpicsString("TEST_STRING") + assert estr._pv.wait_for_connection(timeout=2.0), "PV non connecté" estr("updated") assert estr.get() == "updated" def test_epics_string_special_chars(): estr = EpicsString("TEST_SPECIAL") + assert estr._pv.wait_for_connection(timeout=2.0), "PV non connecté" estr.set("test@value") assert estr.get() == "test@value" \ No newline at end of file