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:
holger krekel 2009-04-17 19:25:15 +02:00
parent 9620583e82
commit 2fd437e465
2 changed files with 15 additions and 0 deletions

View File

@ -69,6 +69,7 @@ class PluginHooks:
def pytest_pyfunc_call(self, pyfuncitem, args, kwargs):
""" 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):
""" return ItemTestReport for the given test outcome. """

View File

@ -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)