Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow colon to be used in test id #25

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pytest_plus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion test/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_a(some: str):
result = pytester.runpytest_inprocess("--collect-only", p1)
if not disable:
assert (
"Test <Function test_a[invalid name]> has an id that does not match our safe pattern '^[\\w_\\-\\.]+$' for use with a terminal."
"Test <Function test_a[invalid name]> has an id that does not match our safe pattern '^[\\w_\\-\\.:]+$' for use with a terminal."
in result.stderr.lines
)
assert result.ret == rc
Expand Down