MCPcopy
hub / github.com/pytest-dev/pytest / deselect_by_mark

Function deselect_by_mark

src/_pytest/mark/__init__.py:255–270  ·  view source on GitHub ↗
(items: list[Item], config: Config)

Source from the content-addressed store, hash-verified

253
254
255def 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
273def _parse_expression(expr: str, exc_message: str) -> Expression:

Callers 1

Calls 6

_parse_expressionFunction · 0.85
evaluateMethod · 0.80
from_markersMethod · 0.80
iter_markersMethod · 0.80
appendMethod · 0.80
pytest_deselectedMethod · 0.80

Tested by

no test coverage detected