Skip to content

Commit

Permalink
Made test_table_column_info more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Oct 24, 2023
1 parent a611dd8 commit 4c9c309
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/test_pvaccess.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import collections
from typing import OrderedDict
from datetime import datetime, timedelta
from time import sleep
from typing import List, OrderedDict

import numpy
from fixtures.mocked_panda import TIMEOUT
from numpy import ndarray
from p4p import Value
from p4p.client.thread import Context

from pandablocks_ioc._types import EpicsName


async def test_table_column_info(
mocked_panda_standard_responses,
mocked_panda_multiple_seq_responses,
table_unpacked_data: OrderedDict[EpicsName, ndarray],
):
"""Test that the table columns have the expected PVAccess information in the
Expand All @@ -21,10 +23,19 @@ async def test_table_column_info(
response_handler,
command_queue,
test_prefix,
) = mocked_panda_standard_responses
) = mocked_panda_multiple_seq_responses

ctxt = Context("pva", nt=False)

table_value: Value = ctxt.get(test_prefix + ":SEQ:TABLE")
capturing_list: List = []
monitor = ctxt.monitor(test_prefix + ":SEQ1:TABLE", capturing_list.append)
start_time = datetime.now()
while not capturing_list and datetime.now() < start_time + timedelta(
seconds=TIMEOUT
):
sleep(1)
table_value = capturing_list[0]
monitor.close()

for (actual_name, actual_value), (expected_name, expected_value) in zip(
table_value.todict(wrapper=collections.OrderedDict)["value"].items(),
Expand Down

0 comments on commit 4c9c309

Please sign in to comment.