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

This commit is contained in:
2025-08-08 00:56:13 +02:00
parent 870215ed0d
commit 856b54c0ad
+11 -6
View File
@@ -82,10 +82,6 @@ def test_put_with_progress_and_repr(value_new, value_before, expected_color):
finally:
builtins.print = original_print
for lines in printed_lines:
print("Aaaaaaa : ", lines, "\n")
print("Next \n")
printed_lines = [line for line in printed_lines if line.strip()]
cleaned_lines = [strip_ansi(line) for line in printed_lines]
@@ -157,14 +153,23 @@ def test_put_without_progress(capture_stdout):
pv = PV("TEST:VAL", connection_timeout=2.0)
assert pv.wait_for_connection(timeout=2.0), "PV not connected"
# First ensure we can write to the PV
test_value = 50.0
pv.put(test_value, wait=True)
assert pv.get() == pytest.approx(test_value), "Basic PV write test failed"
# Now proceed with the actual test
initial_value = pv.get()
new_value = initial_value + 10
# Capture stdout
stdout_before = capture_stdout.getvalue()
pv.put(new_value, show_progress=False)
pv.put(new_value, show_progress=False, wait=True)
stdout_after = capture_stdout.getvalue()
# Verify no output was produced
assert stdout_before == stdout_after, "Expected no output when show_progress=False"
assert pv.get() == pytest.approx(new_value)
# See if update is done
time.sleep(0.1)
assert pv.get() == new_value