Merge pull request #2675 from RonnyPfannschmidt/mark-callspeck
ensure callspecs contain the list of marks
This commit is contained in:
commit
5f17caa156
|
@ -67,10 +67,6 @@ class ParameterSet(namedtuple('ParameterSet', 'values, marks, id')):
|
||||||
|
|
||||||
return cls(argval, marks=newmarks, id=None)
|
return cls(argval, marks=newmarks, id=None)
|
||||||
|
|
||||||
@property
|
|
||||||
def deprecated_arg_dict(self):
|
|
||||||
return dict((mark.name, mark) for mark in self.marks)
|
|
||||||
|
|
||||||
|
|
||||||
class MarkerError(Exception):
|
class MarkerError(Exception):
|
||||||
|
|
||||||
|
|
|
@ -645,14 +645,14 @@ class CallSpec2(object):
|
||||||
self._globalid_args = set()
|
self._globalid_args = set()
|
||||||
self._globalparam = NOTSET
|
self._globalparam = NOTSET
|
||||||
self._arg2scopenum = {} # used for sorting parametrized resources
|
self._arg2scopenum = {} # used for sorting parametrized resources
|
||||||
self.keywords = {}
|
self.marks = []
|
||||||
self.indices = {}
|
self.indices = {}
|
||||||
|
|
||||||
def copy(self, metafunc):
|
def copy(self, metafunc):
|
||||||
cs = CallSpec2(self.metafunc)
|
cs = CallSpec2(self.metafunc)
|
||||||
cs.funcargs.update(self.funcargs)
|
cs.funcargs.update(self.funcargs)
|
||||||
cs.params.update(self.params)
|
cs.params.update(self.params)
|
||||||
cs.keywords.update(self.keywords)
|
cs.marks.extend(self.marks)
|
||||||
cs.indices.update(self.indices)
|
cs.indices.update(self.indices)
|
||||||
cs._arg2scopenum.update(self._arg2scopenum)
|
cs._arg2scopenum.update(self._arg2scopenum)
|
||||||
cs._idlist = list(self._idlist)
|
cs._idlist = list(self._idlist)
|
||||||
|
@ -677,7 +677,7 @@ class CallSpec2(object):
|
||||||
def id(self):
|
def id(self):
|
||||||
return "-".join(map(str, filter(None, self._idlist)))
|
return "-".join(map(str, filter(None, self._idlist)))
|
||||||
|
|
||||||
def setmulti(self, valtypes, argnames, valset, id, keywords, scopenum,
|
def setmulti2(self, valtypes, argnames, valset, id, marks, scopenum,
|
||||||
param_index):
|
param_index):
|
||||||
for arg, val in zip(argnames, valset):
|
for arg, val in zip(argnames, valset):
|
||||||
self._checkargnotcontained(arg)
|
self._checkargnotcontained(arg)
|
||||||
|
@ -686,7 +686,7 @@ class CallSpec2(object):
|
||||||
self.indices[arg] = param_index
|
self.indices[arg] = param_index
|
||||||
self._arg2scopenum[arg] = scopenum
|
self._arg2scopenum[arg] = scopenum
|
||||||
self._idlist.append(id)
|
self._idlist.append(id)
|
||||||
self.keywords.update(keywords)
|
self.marks.extend(marks)
|
||||||
|
|
||||||
def setall(self, funcargs, id, param):
|
def setall(self, funcargs, id, param):
|
||||||
for x in funcargs:
|
for x in funcargs:
|
||||||
|
@ -842,8 +842,8 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
|
||||||
'equal to the number of names ({1})'.format(
|
'equal to the number of names ({1})'.format(
|
||||||
param.values, argnames))
|
param.values, argnames))
|
||||||
newcallspec = callspec.copy(self)
|
newcallspec = callspec.copy(self)
|
||||||
newcallspec.setmulti(valtypes, argnames, param.values, a_id,
|
newcallspec.setmulti2(valtypes, argnames, param.values, a_id,
|
||||||
param.deprecated_arg_dict, scopenum, param_index)
|
param.marks, scopenum, param_index)
|
||||||
newcalls.append(newcallspec)
|
newcalls.append(newcallspec)
|
||||||
self._calls = newcalls
|
self._calls = newcalls
|
||||||
|
|
||||||
|
@ -1115,7 +1115,13 @@ class Function(FunctionMixin, main.Item, fixtures.FuncargnamesCompatAttr):
|
||||||
self.keywords.update(self.obj.__dict__)
|
self.keywords.update(self.obj.__dict__)
|
||||||
if callspec:
|
if callspec:
|
||||||
self.callspec = callspec
|
self.callspec = callspec
|
||||||
self.keywords.update(callspec.keywords)
|
# this is total hostile and a mess
|
||||||
|
# keywords are broken by design by now
|
||||||
|
# this will be redeemed later
|
||||||
|
for mark in callspec.marks:
|
||||||
|
# feel free to cry, this was broken for years before
|
||||||
|
# and keywords cant fix it per design
|
||||||
|
self.keywords[mark.name] = mark
|
||||||
if keywords:
|
if keywords:
|
||||||
self.keywords.update(keywords)
|
self.keywords.update(keywords)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Internally change ``CallSpec2`` to have a list of marks instead of a broken mapping of keywords.
|
||||||
|
This removes the keywords attribute of the internal ``CallSpec2`` class.
|
|
@ -0,0 +1 @@
|
||||||
|
remove ParameterSet.deprecated_arg_dict - its not a public api and the lack of the underscore was a naming error.
|
|
@ -158,7 +158,7 @@ class TestMetafunc(object):
|
||||||
pass
|
pass
|
||||||
metafunc = self.Metafunc(func)
|
metafunc = self.Metafunc(func)
|
||||||
metafunc.parametrize("y", [])
|
metafunc.parametrize("y", [])
|
||||||
assert 'skip' in metafunc._calls[0].keywords
|
assert 'skip' == metafunc._calls[0].marks[0].name
|
||||||
|
|
||||||
def test_parametrize_with_userobjects(self):
|
def test_parametrize_with_userobjects(self):
|
||||||
def func(x, y):
|
def func(x, y):
|
||||||
|
|
Loading…
Reference in New Issue