On Tue, Sep 22, 2015 at 20:27 +0100, Ernesto D. Luzon Jr. wrote: > Hi All, > > I have code below that is based from the snippet provided by Holger: > http://stackoverflow.com/questions/10754970/in-which-py-test-callout-can-i-find-both-item-and-report-data > > def pytest_runtest_makereport(item, call, __multicall__): > rep = __multicall__.execute() > setattr(item, "rep_" + rep.when, rep) > return rep > > Now, I'm struggling how to use hookwrapper instead of __multicall__. > I'd really appreciate if someone can help, thanks!
did you look at: https://pytest.org/latest/writing_plugins.html#hookwrapper-executing-around-other-hooks ? Your above code should look like this: @pytest.hookwrapper def pytest_runtest_makereport(item, call): outcome = yield rep = outcome.get_result() setattr(item, "rep_" + rep.when, rep) return rep best, holger > Many thanks, > Ernesto D. Luzon Jr. > _______________________________________________ > pytest-dev mailing list > [email protected] > https://mail.python.org/mailman/listinfo/pytest-dev -- about me: http://holgerkrekel.net/about-me/ contracting: http://merlinux.eu _______________________________________________ pytest-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/pytest-dev
