rework Node.add_marker parameter list and docstring
This commit is contained in:
parent
9a7c3a65f4
commit
b0ec442d24
|
@ -287,7 +287,11 @@ class MarkInfo(object):
|
||||||
def validate_marks(self, attribute, value):
|
def validate_marks(self, attribute, value):
|
||||||
for item in value:
|
for item in value:
|
||||||
if not isinstance(item, Mark):
|
if not isinstance(item, Mark):
|
||||||
raise ValueError(item)
|
raise ValueError(
|
||||||
|
"MarkInfo expects Mark instances, got {!r} ({!r})".format(
|
||||||
|
item, type(item)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
combined = attr.ib(
|
combined = attr.ib(
|
||||||
repr=False,
|
repr=False,
|
||||||
|
|
|
@ -173,12 +173,10 @@ class Node(object):
|
||||||
chain.reverse()
|
chain.reverse()
|
||||||
return chain
|
return chain
|
||||||
|
|
||||||
def add_marker(self, marker, append=True):
|
def add_marker(self, marker):
|
||||||
""" dynamically add a marker object to the node.
|
"""dynamically add a marker object to the node.
|
||||||
|
|
||||||
``marker`` can be a string or pytest.mark.* instance.
|
:type marker: str or pytest.mark.*
|
||||||
``append=True`` whether to append the marker,
|
|
||||||
if false insert at position 0
|
|
||||||
"""
|
"""
|
||||||
from _pytest.mark import MarkDecorator, MARK_GEN
|
from _pytest.mark import MarkDecorator, MARK_GEN
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue