Fix deprecation notice in Node.get_marker

This commit is contained in:
Bruno Oliveira 2018-05-15 21:47:40 -03:00
parent 2cd159e8c5
commit afe4800daf
2 changed files with 11 additions and 4 deletions

View File

@ -204,7 +204,9 @@ class Node(object):
yield node, mark
def get_closest_marker(self, name, default=None):
"""return the first marker matching the name
"""return the first marker matching the name, from closest (for example function) to farther level (for example
module level).
:param default: fallback return value of no marker was found
:param name: name to filter by
"""
@ -214,9 +216,11 @@ class Node(object):
""" get a marker object from this node or None if
the node doesn't have a marker with that name.
..warning::
deprecated
.. deprecated:: 3.6
This function has been deprecated in favor of
:meth:`Node.get_closest_marker <_pytest.nodes.Node.get_closest_marker>` and
:meth:`Node.iter_markers <_pytest.nodes.Node.iter_markers>`, see :ref:`update marker code`
for more details.
"""
markers = list(self.iter_markers(name=name))
if markers:

View File

@ -51,6 +51,9 @@ in fact, markers where only accessible in functions, even if they where declared
A new API to access markers has been introduced in pytest 3.6 in order to solve the problems with the initial design, providing :func:`_pytest.nodes.Node.iter_markers` method to iterate over markers in a consistent manner and reworking the internals, which solved great deal of problems with the initial design.
.. _update marker code:
Updating code
~~~~~~~~~~~~~