2009-04-18 01:25:15 +08:00
|
|
|
|
|
|
|
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())
|
2009-05-08 00:01:53 +08:00
|
|
|
config.hook.pytest_pyfunc_call(pyfuncitem=item)
|