Skip to content

Commit

Permalink
markers: support new ident '|'
Browse files Browse the repository at this point in the history
  • Loading branch information
hfudev committed Apr 30, 2024
1 parent feaae2f commit 16d317f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
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 @@ def lex(self, input: str) -> Iterator[Token]:
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

0 comments on commit 16d317f

Please sign in to comment.