From c5d7e584828fb430b641264134dc37dbec6dea54 Mon Sep 17 00:00:00 2001 From: Eva Lott Date: Tue, 7 Jan 2025 09:23:57 +0000 Subject: [PATCH] added test for swapping labels post introspection --- tests/fixtures/mocked_panda.py | 3 +-- tests/test-bobfiles/PULSE.bob | 31 +++++++++++++++++++++++++++++-- tests/test_ioc_system.py | 22 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/tests/fixtures/mocked_panda.py b/tests/fixtures/mocked_panda.py index be08b37d..a52aaebd 100644 --- a/tests/fixtures/mocked_panda.py +++ b/tests/fixtures/mocked_panda.py @@ -859,13 +859,12 @@ def standard_responses(table_field_info, table_data_1, table_data_2): "PCAP.GATE.DELAY": "1", "PCAP.ARM": "0", "*METADATA.LABEL_PCAP1": "PcapMetadataLabel", + "*METADATA.LABEL_PULSE1": "OriginalLabel", "PULSE.DELAY": "100", "PULSE.DELAY.UNITS": "ms", }, multiline_values={"SEQ.TABLE": table_data_1}, ), - # 0.5 seconds of no changes in case the ioc setup completes - # before the test starts respond_with_no_changes(number_of_iterations=15), changes_iterator_wrapper( values={ diff --git a/tests/test-bobfiles/PULSE.bob b/tests/test-bobfiles/PULSE.bob index 67890618..6cfea5bd 100644 --- a/tests/test-bobfiles/PULSE.bob +++ b/tests/test-bobfiles/PULSE.bob @@ -3,7 +3,7 @@ 0 0 506 - 116 + 177 4 4 @@ -26,10 +26,37 @@ 1 - PARAMETERS + INPUTS 5 30 496 + 56 + true + + Label + Label + 0 + 0 + 250 + 20 + $(text) + + + TextEntry + TEST_PREFIX:PULSE:LABEL + 255 + 0 + 205 + 20 + 1 + 6 + + + + PARAMETERS + 5 + 91 + 496 81 true diff --git a/tests/test_ioc_system.py b/tests/test_ioc_system.py index 4bec69fd..66d2674e 100644 --- a/tests/test_ioc_system.py +++ b/tests/test_ioc_system.py @@ -83,6 +83,7 @@ async def test_introspect_panda( "PULSE:DELAY": "100", "PCAP:ARM": "0", "PULSE:DELAY:UNITS": "ms", + "PULSE:LABEL": "OriginalLabel", "SEQ:TABLE": table_data_1, } @@ -541,6 +542,27 @@ async def test_metadata_parses_into_single_pv(mocked_panda_standard_responses): ) in multiprocessing_queue_to_list(command_queue) +async def test_metadata_label_update_from_panda_updates_pv( + mocked_panda_standard_responses, +): + ( + tmp_path, + child_conn, + response_handler, + command_queue, + test_prefix, + ) = mocked_panda_standard_responses + camonitor_queue = asyncio.Queue() + m1 = camonitor( + test_prefix + ":PULSE:LABEL", camonitor_queue.put, datatype=DBR_CHAR_STR + ) + try: + assert await asyncio.wait_for(camonitor_queue.get(), TIMEOUT) == "OriginalLabel" + assert await asyncio.wait_for(camonitor_queue.get(), TIMEOUT) == "ANewLabel" + finally: + m1.close() + + async def test_metadata_parses_into_multiple_pvs_caput_single_pv( mocked_panda_multiple_seq_responses, ):