MCPcopy Create free account
hub / github.com/pytest-dev/pytest / normalize_mark_list

Function normalize_mark_list

src/_pytest/mark/structures.py:371–385  ·  view source on GitHub ↗

Normalize an iterable of Mark or MarkDecorator objects into a list of marks by retrieving the `mark` attribute on MarkDecorator instances. :param mark_list: marks to normalize :returns: A new list of the extracted Mark objects

(
    mark_list: Iterable[Union[Mark, MarkDecorator]]
)

Source from the content-addressed store, hash-verified

369
370
371def normalize_mark_list(
372 mark_list: Iterable[Union[Mark, MarkDecorator]]
373) -> Iterable[Mark]:
374 """
375 Normalize an iterable of Mark or MarkDecorator objects into a list of marks
376 by retrieving the `mark` attribute on MarkDecorator instances.
377
378 :param mark_list: marks to normalize
379 :returns: A new list of the extracted Mark objects
380 """
381 for mark in mark_list:
382 mark_obj = getattr(mark, "mark", mark)
383 if not isinstance(mark_obj, Mark):
384 raise TypeError(f"got {repr(mark_obj)} instead of Mark")
385 yield mark_obj
386
387
388def store_mark(obj, mark: Mark) -> None:

Callers 3

setmultiMethod · 0.90
__init__Method · 0.90
get_unpacked_marksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected