Update tests/test_utils_pv.py
Run CI Tests / test (push) Successful in 1m3s

This commit is contained in:
2025-08-07 14:41:32 +02:00
parent 970f59ab73
commit ff8a90ec00
+4 -3
View File
@@ -63,6 +63,7 @@ def strip_ansi(text):
def test_put_with_progress_and_repr(value, expected_color):
pv = PV("TEST:VAL", connection_timeout=2.0)
assert pv.wait_for_connection(timeout=2.0), "PV not connected"
pv.units = "//"
pv.put(0.0, wait=True)
assert pv.get() == pytest.approx(0.0)
@@ -86,11 +87,11 @@ def test_put_with_progress_and_repr(value, expected_color):
# Initialisation bar
matches = [line for line in cleaned_lines if f"| |" in line]
assert matches, f"Expected bar '{expected_bar}' not found in:\n" + "\n".join(printed_lines)
assert matches, f"Expected bar not found in:\n" + "\n".join(printed_lines)
# Vérifie que la bonne barre a été affichée au moins une fois
matches = [line for line in cleaned_lines if f"|██████████████████████████████|" in line]
assert matches, f"Expected bar '{expected_bar}' not found in:\n" + "\n".join(printed_lines)
assert matches, f"Expected bar not found in:\n" + "\n".join(printed_lines)
# Vérifie que la couleur est bien utilisée (au moins une fois dans les lignes printées)
color_matches = [line for line in printed_lines if expected_color in line]
@@ -100,7 +101,7 @@ def test_put_with_progress_and_repr(value, expected_color):
assert pv.get() == pytest.approx(value)
# Représentation
expected_repr = f'PV "TEST:VAL" at {value} units'
expected_repr = f'PV "TEST:VAL" at {value} //'
assert repr(pv) == expected_repr
assert pv.orig_repr().startswith('<epics.pv.PV')