In which py.test callout can I find both 'item' and 'report' data?

后端 未结 2 1989
遥遥无期
遥遥无期 2021-02-09 08:28

pytest_runtest_makereport() gets two arguments, item and call. From item, I can find the funcarg I created for this test, and from call, I can find the exception info (if any):

2条回答
  •  既然无缘
    2021-02-09 08:29

    While hpk42's answer works, __multicall__ is being depreciated.

    This achieves the same result though:

    @pytest.hookimpl(hookwrapper=True)
    def pytest_runtest_makereport(item, call):
        outcome = yield
        rep = outcome.get_result()
        setattr(item, "rep_" + rep.when, rep)
        return rep
    

提交回复
热议问题