File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -462,19 +462,24 @@ Here is an example definition of a hook wrapper::
462462
463463 @pytest.hookimpl(hookwrapper=True)
464464 def pytest_pyfunc_call(pyfuncitem):
465- # do whatever you want before the next hook executes
465+ do_something_before_next_hook_executes()
466466
467467 outcome = yield
468468 # outcome.excinfo may be None or a (cls, val, tb) tuple
469469
470470 res = outcome.get_result() # will raise if outcome was exception
471- # postprocess result
471+
472+ post_process_result(res)
473+
474+ outcome.force_result(new_res) # to override the return value to the plugin system
472475
473476Note that hook wrappers don't return results themselves, they merely
474477perform tracing or other side effects around the actual hook implementations.
475478If the result of the underlying hook is a mutable object, they may modify
476479that result but it's probably better to avoid it.
477480
481+ For more information, consult the `pluggy documentation <http://pluggy.readthedocs.io/en/latest/#wrappers >`_.
482+
478483
479484Hook function ordering / call example
480485-------------------------------------
You can’t perform that action at this time.
0 commit comments