Skip to content

Commit 0b75c64

Browse files
committed
Allow colon to be used in test id
Fixes: ansible/ansible-compat#340
1 parent 6ff466a commit 0b75c64

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/pytest_plus/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def get_max_test_id_length() -> int:
1818
def get_test_id_regex() -> None | re.Pattern[str]:
1919
"""Return regex to use for checking test ids."""
2020
if int(os.environ.get("PYTEST_CHECK_TEST_ID_REGEX", "1")):
21-
return re.compile(r"^[\w_\-\.]+$")
21+
return re.compile(r"^[\w_\-\.:]+$")
2222
return None
2323

2424

test/test_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_a(some: str):
6060
result = pytester.runpytest_inprocess("--collect-only", p1)
6161
if not disable:
6262
assert (
63-
"Test <Function test_a[invalid name]> has an id that does not match our safe pattern '^[\\w_\\-\\.]+$' for use with a terminal."
63+
"Test <Function test_a[invalid name]> has an id that does not match our safe pattern '^[\\w_\\-\\.:]+$' for use with a terminal."
6464
in result.stderr.lines
6565
)
6666
assert result.ret == rc

0 commit comments

Comments
 (0)