(items: list[Item], config: Config)
| 253 | |
| 254 | |
| 255 | def deselect_by_mark(items: list[Item], config: Config) -> None: |
| 256 | matchexpr = config.option.markexpr |
| 257 | if not matchexpr: |
| 258 | return |
| 259 | |
| 260 | expr = _parse_expression(matchexpr, "Wrong expression passed to '-m'") |
| 261 | remaining: list[Item] = [] |
| 262 | deselected: list[Item] = [] |
| 263 | for item in items: |
| 264 | if expr.evaluate(MarkMatcher.from_markers(item.iter_markers())): |
| 265 | remaining.append(item) |
| 266 | else: |
| 267 | deselected.append(item) |
| 268 | if deselected: |
| 269 | config.hook.pytest_deselected(items=deselected) |
| 270 | items[:] = remaining |
| 271 | |
| 272 | |
| 273 | def _parse_expression(expr: str, exc_message: str) -> Expression: |
no test coverage detected