[py-svn] commit/pytest: RonnyPfannschmidt: move Item.applymarker to Node, and defer to it from Funcargrequest.applymarker
Bitbucket
commits-noreply at bitbucket.org
Sun Sep 30 22:19:20 CEST 2012
1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/changeset/1f79503ce1f8/
changeset: 1f79503ce1f8
user: RonnyPfannschmidt
date: 2012-09-30 22:17:33
summary: move Item.applymarker to Node, and defer to it from Funcargrequest.applymarker
affected #: 2 files
diff -r 9605c7f187c700413544b84c3eb65bc6eafa0a4f -r 1f79503ce1f8a68185c7f8b2900546fb84606adb _pytest/main.py
--- a/_pytest/main.py
+++ b/_pytest/main.py
@@ -196,6 +196,18 @@
""" dictionary of Keywords / markers on this node. """
return vars(self.markers)
+ def applymarker(self, marker):
+ """ Apply a marker to this item. This method is
+ useful if you have several parametrized function
+ and want to mark a single one of them.
+
+ :arg marker: a :py:class:`_pytest.mark.MarkDecorator` object
+ created by a call to ``py.test.mark.NAME(...)``.
+ """
+ if not isinstance(marker, pytest.mark.XYZ.__class__):
+ raise ValueError("%r is not a py.test.mark.* object")
+ setattr(self.markers, marker.markname, marker)
+
#def extrainit(self):
# """"extra initialization after Node is initialized. Implemented
# by some subclasses. """
@@ -390,19 +402,6 @@
def reportinfo(self):
return self.fspath, None, ""
- def applymarker(self, marker):
- """ Apply a marker to this item. This method is
- useful if you have several parametrized function
- and want to mark a single one of them.
-
- :arg marker: a :py:class:`_pytest.mark.MarkDecorator` object
- created by a call to ``py.test.mark.NAME(...)``.
- """
- if not isinstance(marker, pytest.mark.XYZ.__class__):
- raise ValueError("%r is not a py.test.mark.* object")
- self.keywords[marker.markname] = marker
-
-
@property
def location(self):
try:
diff -r 9605c7f187c700413544b84c3eb65bc6eafa0a4f -r 1f79503ce1f8a68185c7f8b2900546fb84606adb _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -1068,9 +1068,7 @@
:arg marker: a :py:class:`_pytest.mark.MarkDecorator` object
created by a call to ``py.test.mark.NAME(...)``.
"""
- if not isinstance(marker, py.test.mark.XYZ.__class__):
- raise ValueError("%r is not a py.test.mark.* object")
- setattr(self.node.markers, marker.markname, marker)
+ self.node.applymarker(marker)
def raiseerror(self, msg):
""" raise a FuncargLookupError with the given message. """
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list