diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2018-03-16 11:16:08 +0100 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2018-03-29 17:52:01 +0200 |
commit | 27072215593b2808bbae2fb633caf556cc5852e3 (patch) | |
tree | b734d0bb4220e2be60ade564b405f852bedca0c0 /_pytest | |
parent | 360d608da4e11c66539967e625c70e6cae31395e (diff) | |
download | pytest-27072215593b2808bbae2fb633caf556cc5852e3.tar.gz |
port mark evaluation to the new storage and fix a bug in evaluation
Diffstat (limited to '_pytest')
-rw-r--r-- | _pytest/fixtures.py | 5 | ||||
-rw-r--r-- | _pytest/mark/evaluate.py | 11 |
2 files changed, 2 insertions, 14 deletions
diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py index 2ac340e6f..5c6a4a230 100644 --- a/_pytest/fixtures.py +++ b/_pytest/fixtures.py @@ -371,10 +371,7 @@ class FixtureRequest(FuncargnamesCompatAttr): :arg marker: a :py:class:`_pytest.mark.MarkDecorator` object created by a call to ``pytest.mark.NAME(...)``. """ - try: - self.node.keywords[marker.markname] = marker - except AttributeError: - raise ValueError(marker) + self.node.add_marker(marker) def raiseerror(self, msg): """ raise a FixtureLookupError with the given message. """ diff --git a/_pytest/mark/evaluate.py b/_pytest/mark/evaluate.py index 295373e17..1aef138b1 100644 --- a/_pytest/mark/evaluate.py +++ b/_pytest/mark/evaluate.py @@ -4,7 +4,6 @@ import sys import platform import traceback -from . import MarkDecorator, MarkInfo from ..outcomes import fail, TEST_OUTCOME @@ -28,7 +27,6 @@ class MarkEvaluator(object): self._mark_name = name def __bool__(self): - self._marks = self._get_marks() return bool(self._marks) __nonzero__ = __bool__ @@ -36,14 +34,7 @@ class MarkEvaluator(object): return not hasattr(self, 'exc') def _get_marks(self): - - keyword = self.item.keywords.get(self._mark_name) - if isinstance(keyword, MarkDecorator): - return [keyword.mark] - elif isinstance(keyword, MarkInfo): - return [x.combined for x in keyword] - else: - return [] + return list(self.item.find_markers(self._mark_name)) def invalidraise(self, exc): raises = self.get('raises') |