From 9c088d8143856180fe174ee2134f2dc68e5a6124 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 10 Jan 2024 12:17:07 +0000 Subject: [PATCH] Allow colon to be used in test id (#25) Fixes: https://github.com/ansible/ansible-compat/issues/340 --- src/pytest_plus/__init__.py | 2 +- test/test_plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pytest_plus/__init__.py b/src/pytest_plus/__init__.py index 9b37304..515c019 100644 --- a/src/pytest_plus/__init__.py +++ b/src/pytest_plus/__init__.py @@ -18,7 +18,7 @@ def get_max_test_id_length() -> int: def get_test_id_regex() -> None | re.Pattern[str]: """Return regex to use for checking test ids.""" if int(os.environ.get("PYTEST_CHECK_TEST_ID_REGEX", "1")): - return re.compile(r"^[\w_\-\.]+$") + return re.compile(r"^[\w_\-\.:]+$") return None diff --git a/test/test_plugin.py b/test/test_plugin.py index 0c17bb3..38c28f6 100644 --- a/test/test_plugin.py +++ b/test/test_plugin.py @@ -60,7 +60,7 @@ def test_a(some: str): result = pytester.runpytest_inprocess("--collect-only", p1) if not disable: assert ( - "Test has an id that does not match our safe pattern '^[\\w_\\-\\.]+$' for use with a terminal." + "Test has an id that does not match our safe pattern '^[\\w_\\-\\.:]+$' for use with a terminal." in result.stderr.lines ) assert result.ret == rc