port mark evaluation to the new storage and fix a bug in evaluation
This commit is contained in:
parent
360d608da4
commit
2707221559
|
@ -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. """
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -715,7 +715,6 @@ class TestFunctional(object):
|
|||
if isinstance(v, MarkInfo)])
|
||||
assert marker_names == set(expected_markers)
|
||||
|
||||
@pytest.mark.xfail(reason='callspec2.setmulti misuses keywords')
|
||||
@pytest.mark.issue1540
|
||||
def test_mark_from_parameters(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
|
|
Loading…
Reference in New Issue