correctly instantiate fixtureinfo for unittest tests, fixes #3498

This commit is contained in:
Ronny Pfannschmidt 2018-05-24 10:29:42 +02:00
parent da2c2e8492
commit 5a0c9aca63
4 changed files with 5 additions and 3 deletions

View File

@ -984,7 +984,7 @@ class FixtureManager(object):
session.config.pluginmanager.register(self, "funcmanage")
def getfixtureinfo(self, node, func, cls, funcargs=True):
if funcargs and not hasattr(node, "nofuncargs"):
if funcargs and not getattr(node, "nofuncargs", False):
argnames = getfuncargnames(func, cls=cls)
else:
argnames = ()

View File

@ -1155,7 +1155,7 @@ class Function(FunctionMixin, nodes.Item, fixtures.FuncargnamesCompatAttr):
if fixtureinfo is None:
fixtureinfo = self.session._fixturemanager.getfixtureinfo(
self.parent, self.obj, self.cls,
self, self.obj, self.cls,
funcargs=not self._isyieldedfunction())
self._fixtureinfo = fixtureinfo
self.fixturenames = fixtureinfo.names_closure

View File

@ -54,7 +54,7 @@ class UnitTestCase(Class):
continue
funcobj = getattr(x, 'im_func', x)
transfer_markers(funcobj, cls, module)
yield TestCaseFunction(name, parent=self)
yield TestCaseFunction(name, parent=self, callobj=funcobj)
foundsomething = True
if not foundsomething:
@ -66,6 +66,7 @@ class UnitTestCase(Class):
class TestCaseFunction(Function):
nofuncargs = True
_excinfo = None
def setup(self):

1
changelog/3498.bugfix Normal file
View File

@ -0,0 +1 @@
correctly instantiate fixtureinfo for unittest tests.