correctly instantiate fixtureinfo for unittest tests, fixes #3498
This commit is contained in:
		
							parent
							
								
									da2c2e8492
								
							
						
					
					
						commit
						5a0c9aca63
					
				| 
						 | 
				
			
			@ -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 = ()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
correctly instantiate fixtureinfo for unittest tests.
 | 
			
		||||
		Loading…
	
		Reference in New Issue