allow unittest test functions to work with the "pytestmark" mechanism
by refactoring mark/keyword handling and initialization --HG-- branch : trunk
This commit is contained in:
@@ -136,6 +136,7 @@ class PyCollectorMixin(PyobjMixin, pytest.collect.Collector):
|
||||
|
||||
def collect(self):
|
||||
# NB. we avoid random getattrs and peek in the __dict__ instead
|
||||
# (XXX originally introduced from a PyPy need, still true?)
|
||||
dicts = [getattr(self.obj, '__dict__', {})]
|
||||
for basecls in inspect.getmro(self.obj.__class__):
|
||||
dicts.append(basecls.__dict__)
|
||||
@@ -254,9 +255,6 @@ class Instance(PyCollectorMixin, pytest.collect.Collector):
|
||||
def _getobj(self):
|
||||
return self.parent.obj()
|
||||
|
||||
def _keywords(self):
|
||||
return []
|
||||
|
||||
def newinstance(self):
|
||||
self.obj = self._getobj()
|
||||
return self.obj
|
||||
@@ -449,6 +447,7 @@ def hasinit(obj):
|
||||
|
||||
|
||||
def getfuncargnames(function):
|
||||
# XXX merge with _core.py's varnames
|
||||
argnames = py.std.inspect.getargs(py.code.getrawcode(function))[0]
|
||||
startindex = py.std.inspect.ismethod(function) and 1 or 0
|
||||
defaults = getattr(function, 'func_defaults',
|
||||
|
||||
Reference in New Issue
Block a user