diff --git a/src/srx_caproto_iocs/base.py b/src/srx_caproto_iocs/base.py index 2ad314f..9fb1faf 100644 --- a/src/srx_caproto_iocs/base.py +++ b/src/srx_caproto_iocs/base.py @@ -39,14 +39,14 @@ class CaprotoSaveIOC(PVGroup): value="/tmp", doc="The directory to write data to. It support datetime formatting, e.g. '/tmp/det/%Y/%m/%d/'", string_encoding="utf-8", - report_as_string=True, + dtype=ChannelType.CHAR, max_length=255, ) file_name = pvproperty( value="test.h5", doc="The file name of the file to write to. It support .format() based formatting, e.g. 'scan_{num:06d}.h5'", string_encoding="utf-8", - report_as_string=True, + dtype=ChannelType.CHAR, max_length=255, ) full_file_path = pvproperty( diff --git a/tests/test_base_ophyd.py b/tests/test_base_ophyd.py index f5ecade..d052bb1 100644 --- a/tests/test_base_ophyd.py +++ b/tests/test_base_ophyd.py @@ -22,7 +22,12 @@ def test_base_ophyd_templates( date = now(as_object=True) write_dir_root = Path(tmpdirname) dir_template = f"{write_dir_root}/{date_template}" - write_dir = Path(date.strftime(dir_template)) + + # We pre-create the test directory in advance as the IOC is not supposed to create one. + # The assumption for the IOC is that the directory will exist before saving a file to that. + # We need to replace the blank spaces below for it to work, as the IOC will replace + # any blank spaces in `full_file_path` before returning the value. + write_dir = Path(date.strftime(dir_template).replace(" ", "_")) write_dir.mkdir(parents=True, exist_ok=True) file_template = "scan_{num:06d}_{uid}.hdf5"