Skip to content

Commit 0604d88

Browse files
Add Yield call to ensure IOC processes new value
1 parent f3b36cf commit 0604d88

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_records.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ def run_test_function(
357357

358358

359359
try:
360+
from cothread import Yield
360361
from cothread.catools import caget, caput, _channel_cache
361362

362363
# cothread remembers connected IOCs. As we restart the same named
@@ -371,6 +372,11 @@ def run_test_function(
371372
initial_value,
372373
wait=True,
373374
**put_kwargs)
375+
# Ensure IOC process has time to execute.
376+
# I saw failures on MacOS where it appeared the IOC had not
377+
# processed the put'ted value as the caget returned the same value
378+
# as was originally passed in.
379+
Yield(timeout=TIMEOUT)
374380

375381
if get_enum == GetValueEnum.GET:
376382
rec_val = queue.get(timeout=TIMEOUT)
@@ -379,7 +385,8 @@ def run_test_function(
379385
DEVICE_NAME + ":" + RECORD_NAME,
380386
timeout=TIMEOUT,
381387
**get_kwargs)
382-
388+
# '+' operator used to convert cothread's types into Python native
389+
# types e.g. "+ca_int" -> int
383390
rec_val = +rec_val
384391

385392

0 commit comments

Comments
 (0)