ref addresses 4
The first non-None value returned by a pytest_pyfunc_call hook method now indicates that the function call has been performed. --HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									9620583e82
								
							
						
					
					
						commit
						2fd437e465
					
				| 
						 | 
					@ -69,6 +69,7 @@ class PluginHooks:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def pytest_pyfunc_call(self, pyfuncitem, args, kwargs):
 | 
					    def pytest_pyfunc_call(self, pyfuncitem, args, kwargs):
 | 
				
			||||||
        """ return True if we consumed/did the call to the python function item. """
 | 
					        """ return True if we consumed/did the call to the python function item. """
 | 
				
			||||||
 | 
					    pytest_pyfunc_call.firstresult = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def pytest_item_makereport(self, item, excinfo, when, outerr):
 | 
					    def pytest_item_makereport(self, item, excinfo, when, outerr):
 | 
				
			||||||
        """ return ItemTestReport for the given test outcome. """
 | 
					        """ return ItemTestReport for the given test outcome. """
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TestPyfuncHooks:
 | 
				
			||||||
 | 
					    def test_pyfunc_call(self, testdir):
 | 
				
			||||||
 | 
					        item = testdir.getitem("def test_func(): raise ValueError")
 | 
				
			||||||
 | 
					        config = item.config
 | 
				
			||||||
 | 
					        class MyPlugin1:
 | 
				
			||||||
 | 
					            def pytest_pyfunc_call(self, pyfuncitem, *args, **kwargs):
 | 
				
			||||||
 | 
					                raise ValueError
 | 
				
			||||||
 | 
					        class MyPlugin2:
 | 
				
			||||||
 | 
					            def pytest_pyfunc_call(self, pyfuncitem, *args, **kwargs):
 | 
				
			||||||
 | 
					                return True
 | 
				
			||||||
 | 
					        config.pluginmanager.register(MyPlugin1())
 | 
				
			||||||
 | 
					        config.pluginmanager.register(MyPlugin2())
 | 
				
			||||||
 | 
					        config.api.pytest_pyfunc_call(pyfuncitem=item)
 | 
				
			||||||
		Loading…
	
		Reference in New Issue