Trigger command line expr to run compile with mark checks

This commit is contained in:
Max Berkowitz 2024-04-26 00:36:30 -04:00 committed by GitHub
parent 58521efcaa
commit 6c4c3036e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -236,7 +236,7 @@ def deselect_by_mark(items: "List[Item]", config: Config) -> None:
if not matchexpr:
return
expr = _parse_expression(matchexpr, "Wrong expression passed to '-m'")
expr = _parse_expression(matchexpr, "Wrong expression passed to '-m'", True)
remaining: List[Item] = []
deselected: List[Item] = []
for item in items:
@ -249,9 +249,9 @@ def deselect_by_mark(items: "List[Item]", config: Config) -> None:
items[:] = remaining
def _parse_expression(expr: str, exc_message: str) -> Expression:
def _parse_expression(expr: str, exc_message: str, mark: bool = False) -> Expression:
try:
return Expression.compile(expr)
return Expression.compile(expr, mark)
except ParseError as e:
raise UsageError(f"{exc_message}: {expr}: {e}") from None