diff --git a/src/fastcs/transports/epics/ca/util.py b/src/fastcs/transports/epics/ca/util.py index 6a3e6dd8..66803951 100644 --- a/src/fastcs/transports/epics/ca/util.py +++ b/src/fastcs/transports/epics/ca/util.py @@ -13,13 +13,13 @@ from fastcs.exceptions import FastCSError from fastcs.transports.epics.util import validate_epics_pv_id -_CA_ID_RE = re.compile(r"^[A-Za-z0-9_-]+$") +_CA_ID_RE = re.compile(r"^[A-Za-z0-9_:-]+$") def validate_ca_id(controller_api: ControllerAPI) -> None: """Reject controller ids that wouldn't be safe in an EPICS CA PV name. - Rejects ids with characters outside ``[A-Za-z0-9_-]`` and rejects setups + Rejects ids with characters outside ``[A-Za-z0-9_:-]`` and rejects setups where the longest derivable PV prefix already exceeds the 60-character EPICS PV name limit. """ diff --git a/src/fastcs/transports/epics/pva/util.py b/src/fastcs/transports/epics/pva/util.py index 624e378f..0722a023 100644 --- a/src/fastcs/transports/epics/pva/util.py +++ b/src/fastcs/transports/epics/pva/util.py @@ -3,13 +3,13 @@ from fastcs.controllers import ControllerAPI from fastcs.transports.epics.util import validate_epics_pv_id -_PVA_ID_RE = re.compile(r"^[A-Za-z0-9_-]+$") +_PVA_ID_RE = re.compile(r"^[A-Za-z0-9_:-]+$") def validate_pva_id(controller_api: ControllerAPI) -> None: """Reject controller ids that wouldn't be safe in an EPICS PVA PV name. - Rejects ids with characters outside ``[A-Za-z0-9_-]`` and rejects setups + Rejects ids with characters outside ``[A-Za-z0-9_:-]`` and rejects setups where the longest derivable PV prefix already exceeds the 60-character EPICS PV name limit. """ diff --git a/src/fastcs/transports/epics/util.py b/src/fastcs/transports/epics/util.py index d591d1ef..6e81faba 100644 --- a/src/fastcs/transports/epics/util.py +++ b/src/fastcs/transports/epics/util.py @@ -36,7 +36,7 @@ def validate_epics_pv_id( if not id_re.fullmatch(name): raise ValueError( f"Controller id {name!r} is not a valid {transport_label}; " - "only alphanumerics, '-' and '_' are allowed" + "only alphanumerics, '-', '_', and ':' are allowed" ) longest_prefix = max( len(pv_prefix_from_path(api.path)) for api in controller_api.walk_api() diff --git a/tests/transports/epics/ca/test_ca_util.py b/tests/transports/epics/ca/test_ca_util.py index 463a17dc..fd59dc35 100644 --- a/tests/transports/epics/ca/test_ca_util.py +++ b/tests/transports/epics/ca/test_ca_util.py @@ -140,7 +140,7 @@ def test_validate_ca_id_accepts_valid(id): validate_ca_id(ControllerAPI(path=[id])) -@pytest.mark.parametrize("id", ["bad/id", "with space", "colons:in:id", ""]) +@pytest.mark.parametrize("id", ["bad/id", "with space", ""]) def test_validate_ca_id_rejects_illegal_characters(id): with pytest.raises(ValueError, match="EPICS CA id"): validate_ca_id(ControllerAPI(path=[id])) diff --git a/tests/transports/epics/pva/test_pva_util.py b/tests/transports/epics/pva/test_pva_util.py index 13cd5bb8..5f895042 100644 --- a/tests/transports/epics/pva/test_pva_util.py +++ b/tests/transports/epics/pva/test_pva_util.py @@ -9,7 +9,7 @@ def test_validate_pva_id_accepts_valid(name): validate_pva_id(ControllerAPI(path=[name])) -@pytest.mark.parametrize("name", ["bad/id", "with space", "colons:in:id", ""]) +@pytest.mark.parametrize("name", ["bad/id", "with space", ""]) def test_validate_pva_id_rejects_illegal_characters(name): with pytest.raises(ValueError, match="EPICS PVA id"): validate_pva_id(ControllerAPI(path=[name]))