Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/_pytest/mark/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def test_function():

"""

mark = attr.ib(validator=attr.validators.instance_of(Mark))
mark = attr.ib()

@property
def name(self):
Expand Down Expand Up @@ -278,20 +278,13 @@ def normalize_mark_list(mark_list):
:type mark_list: List[Union[Mark, Markdecorator]]
:rtype: List[Mark]
"""
extracted = [
getattr(mark, "mark", mark) for mark in mark_list
] # unpack MarkDecorator
for mark in extracted:
if not isinstance(mark, Mark):
raise TypeError("got {!r} instead of Mark".format(mark))
return [x for x in extracted if isinstance(x, Mark)]
return [getattr(mark, "mark", mark) for mark in mark_list] # unpack MarkDecorator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for safety, this should only extract markdecorators



def store_mark(obj, mark):
"""store a Mark on an object
this is used to implement the Mark declarations/decorators correctly
"""
assert isinstance(mark, Mark), mark
# always reassign name to avoid updating pytestmark
# in a reference that was only borrowed
obj.pytestmark = get_unpacked_marks(obj) + [mark]
Expand Down Expand Up @@ -352,6 +345,9 @@ def __getattr__(self, name: str) -> MarkDecorator:

return MarkDecorator(Mark(name, (), {}))

def __call__(self, m):
return MarkDecorator(m)


MARK_GEN = MarkGenerator()

Expand Down