@@ -123,14 +123,14 @@ def record_values_names(fixture_value):
123123 "wIn_list" ,
124124 builder .WaveformIn ,
125125 [1 , 2 , 3 ],
126- numpy .array ([1 , 2 , 3 ], dtype = numpy .float32 ),
126+ numpy .array ([1 , 2 , 3 ], dtype = numpy .int64 ),
127127 numpy .ndarray ,
128128 ),
129129 (
130130 "wOut_list" ,
131131 builder .WaveformOut ,
132132 [1 , 2 , 3 ],
133- numpy .array ([1 , 2 , 3 ], dtype = numpy .float32 ),
133+ numpy .array ([1 , 2 , 3 ], dtype = numpy .int64 ),
134134 numpy .ndarray ,
135135 ),
136136 (
@@ -151,14 +151,14 @@ def record_values_names(fixture_value):
151151 "wIn_float" ,
152152 builder .WaveformIn ,
153153 12.345 ,
154- numpy .array ([12.345 ], dtype = numpy .float32 ),
154+ numpy .array ([12.345 ], dtype = numpy .float64 ),
155155 numpy .ndarray ,
156156 ),
157157 (
158158 "wOut_float" ,
159159 builder .WaveformOut ,
160160 12.345 ,
161- numpy .array ([12.345 ], dtype = numpy .float32 ),
161+ numpy .array ([12.345 ], dtype = numpy .float64 ),
162162 numpy .ndarray ,
163163 ),
164164 (
@@ -460,8 +460,11 @@ def run_test_function(
460460 pytest .fail ("IOC process did not start before TIMEOUT expired" )
461461
462462 try :
463+ # Cannot do these imports before the subprocess starts, as cothread
464+ # isn't threadsafe (in the way we require)
463465 from cothread import Yield
464466 from cothread .catools import caget , caput , _channel_cache
467+ from cothread .dbr import DBR_CHAR_STR
465468
466469 # cothread remembers connected IOCs. As we potentially restart the same
467470 # named IOC multiple times, we have to purge the cache else the
@@ -480,10 +483,16 @@ def run_test_function(
480483
481484 # Infer some required keywords from parameters
482485 kwargs = {}
486+ put_kwarg = {}
483487 if creation_func in [builder .longStringIn , builder .longStringOut ]:
484- from cothread .dbr import DBR_CHAR_STR
485488 kwargs .update ({"datatype" : DBR_CHAR_STR })
486489
490+ if (creation_func in [builder .WaveformIn , builder .WaveformOut ]
491+ and type (initial_value ) is bytes ):
492+ # Want to put bytestrings using this, but then retrieve the
493+ # value as an array so NOT specify datatype there
494+ put_kwarg .update ({"datatype" : DBR_CHAR_STR })
495+
487496 if set_enum == SetValueEnum .CAPUT :
488497 if get_enum == GetValueEnum .GET :
489498 if parent_conn .poll (TIMEOUT ):
@@ -494,7 +503,8 @@ def run_test_function(
494503 DEVICE_NAME + ":" + record_name ,
495504 initial_value ,
496505 wait = True ,
497- ** kwargs
506+ ** kwargs ,
507+ ** put_kwarg ,
498508 )
499509
500510 if get_enum == GetValueEnum .GET :
@@ -691,25 +701,19 @@ def test_value_post_init_caput(self):
691701 """Test that records provide the expected values on get calls when using
692702 .set() before IOC initialisation and caget after initialisation"""
693703
694- # Various conditions mean we cannot use the entire list of cases
704+ # Various conditions (e.g.) mean we cannot use the entire list of cases
695705 filtered_list = []
696706 for item in record_values_list :
697- if (
698- item [1 ] in [builder .stringIn , builder .stringOut ]
699- and len (item [2 ]) > 40
700- ):
701- # caput blocks long strings
702- continue
703-
707+ # In records block caputs
704708 if item [1 ] not in [
705709 builder .aIn ,
706710 builder .boolIn ,
707711 builder .longIn ,
708712 builder .mbbIn ,
709713 builder .stringIn ,
710714 builder .WaveformIn ,
715+ builder .longStringIn ,
711716 ]:
712- # In records block caput
713717 filtered_list .append (item )
714718
715719 run_test_function (filtered_list , SetValueEnum .CAPUT , GetValueEnum .CAGET )
@@ -751,7 +755,7 @@ class TestDefaultValue:
751755 (builder .stringIn , "" , str ),
752756 (builder .mbbOut , None , type (None )),
753757 (builder .mbbIn , 0 , int ),
754- (builder .WaveformOut , None , type ( None ) ),
758+ (builder .WaveformOut , numpy . empty ( 0 ), numpy . ndarray ),
755759 (builder .WaveformIn , numpy .empty (0 ), numpy .ndarray ),
756760 (builder .longStringOut , "" , str ),
757761 (builder .longStringIn , "" , str ),
0 commit comments