diff options
author | Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> | 2012-09-30 22:17:33 +0200 |
---|---|---|
committer | Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> | 2012-09-30 22:17:33 +0200 |
commit | bee75437169bc16b5ac9e48954144bd227b8dd9f (patch) | |
tree | 1241e5bdb76b9e0615648b1096290f6cb5b58d2e /_pytest/main.py | |
parent | b9767fd74c637353b4fb108867a8694003042b5e (diff) | |
download | pytest-bee75437169bc16b5ac9e48954144bd227b8dd9f.tar.gz |
move Item.applymarker to Node, and defer to it from Funcargrequest.applymarker
Diffstat (limited to '_pytest/main.py')
-rw-r--r-- | _pytest/main.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/_pytest/main.py b/_pytest/main.py index 002dc59a7..ccd8c058e 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -196,6 +196,18 @@ class Node(object): """ 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 @@ class Item(Node): 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: |