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

markers: support new ident '|' #12277

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ Florian Bruhin
Florian Dahlitz
Floris Bruynooghe
Fraser Stark
Fu Hanxi
Gabriel Landau
Gabriel Reis
Garvit Shubham
Expand Down
1 change: 1 addition & 0 deletions changelog/12277.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Supported vertical bar ``|`` inside a marker.
4 changes: 2 additions & 2 deletions src/_pytest/mark/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
expr: and_expr ('or' and_expr)*
and_expr: not_expr ('and' not_expr)*
not_expr: 'not' not_expr | '(' expr ')' | ident
ident: (\w|:|\+|-|\.|\[|\]|\\|/)+
ident: (\w|:|\+|-|\.|\[|\]|\\|/|\|)+

The semantics are:

Expand Down Expand Up @@ -86,7 +86,7 @@
yield Token(TokenType.RPAREN, ")", pos)
pos += 1
else:
match = re.match(r"(:?\w|:|\+|-|\.|\[|\]|\\|/)+", input[pos:])
match = re.match(r"(:?\w|:|\+|-|\.|\[|\]|\\|/|\|)+", input[pos:])

Check warning on line 89 in src/_pytest/mark/expression.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/mark/expression.py#L89

Added line #L89 was not covered by tests
if match:
value = match.group(0)
if value == "or":
Expand Down