44import pytest
55
66from conftest import (
7+ log ,
78 create_random_prefix ,
89 requires_cothread ,
910 _clear_records ,
@@ -376,14 +377,14 @@ def on_update_done(_):
376377
377378 conn .send ("R" ) # "Ready"
378379
379- print ("CHILD: Sent R over Connection to Parent" )
380+ log ("CHILD: Sent R over Connection to Parent" )
380381
381382 # Keep process alive while main thread runs CAGET
382383 if conn .poll (TIMEOUT ):
383384 val = conn .recv ()
384385 assert val == "D" , "Did not receive expected Done character"
385386
386- print ("CHILD: Received exit command, child exiting" )
387+ log ("CHILD: Received exit command, child exiting" )
387388
388389 def on_update_runner (self , creation_func , always_update , put_same_value ):
389390 parent_conn , child_conn = multiprocessing .Pipe ()
@@ -397,15 +398,15 @@ def on_update_runner(self, creation_func, always_update, put_same_value):
397398
398399 process .start ()
399400
400- print ("PARENT: Child started, waiting for R command" )
401+ log ("PARENT: Child started, waiting for R command" )
401402
402403 from cothread .catools import caget , caput , _channel_cache
403404
404405 try :
405406 # Wait for message that IOC has started
406407 select_and_recv (parent_conn , "R" )
407408
408- print ("PARENT: received R command" )
409+ log ("PARENT: received R command" )
409410
410411
411412 # Suppress potential spurious warnings
@@ -416,7 +417,7 @@ def on_update_runner(self, creation_func, always_update, put_same_value):
416417 # value to force processing to occur
417418 count = 1
418419
419- print ("PARENT: begining While loop" )
420+ log ("PARENT: begining While loop" )
420421
421422 while count < 4 :
422423 put_ret = caput (
@@ -426,26 +427,26 @@ def on_update_runner(self, creation_func, always_update, put_same_value):
426427 )
427428 assert put_ret .ok , f"caput did not succeed: { put_ret .errorcode } "
428429
429- print (f"PARENT: completed caput with count { count } " )
430+ log (f"PARENT: completed caput with count { count } " )
430431
431432 count += 1
432433
433- print ("PARENT: Put'ing to DONE record" )
434+ log ("PARENT: Put'ing to DONE record" )
434435
435436 caput (
436437 device_name + ":ON-UPDATE-DONE" ,
437438 1 ,
438439 wait = True ,
439440 )
440441
441- print ("PARENT: Waiting for C command" )
442+ log ("PARENT: Waiting for C command" )
442443
443444 # Wait for action record to process, so we know all the callbacks
444445 # have finished processing (This assumes record callbacks are not
445446 # re-ordered, and will run in the same order as the caputs we sent)
446447 select_and_recv (parent_conn , "C" )
447448
448- print ("PARENT: Received C command" )
449+ log ("PARENT: Received C command" )
449450
450451 ret_val = caget (
451452 device_name + ":ON-UPDATE-COUNTER-RECORD" ,
@@ -454,7 +455,7 @@ def on_update_runner(self, creation_func, always_update, put_same_value):
454455 assert ret_val .ok , \
455456 f"caget did not succeed: { ret_val .errorcode } , { ret_val } "
456457
457- print (f"PARENT: Received val from COUNTER: { ret_val } " )
458+ log (f"PARENT: Received val from COUNTER: { ret_val } " )
458459
459460
460461 # Expected value is either 3 (incremented once per caput)
@@ -469,10 +470,10 @@ def on_update_runner(self, creation_func, always_update, put_same_value):
469470 # Suppress potential spurious warnings
470471 _channel_cache .purge ()
471472
472- print ("PARENT:Sending Done command to child" )
473+ log ("PARENT:Sending Done command to child" )
473474 parent_conn .send ("D" ) # "Done"
474475 process .join (timeout = TIMEOUT )
475- print (f"PARENT: Join completed with exitcode { process .exitcode } " )
476+ log (f"PARENT: Join completed with exitcode { process .exitcode } " )
476477 if process .exitcode is None :
477478 pytest .fail ("Process did not terminate" )
478479
0 commit comments