Hi Holger, Thanks a lot! That worked. Now I am no longer getting 'deprecated __multicall__' warnings from pytest 2.8.
Many thanks, Ernesto D. Luzon Jr. On Wed, Sep 23, 2015 at 11:00 AM, <[email protected]> wrote: > Send pytest-dev mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/pytest-dev > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of pytest-dev digest..." > > > Today's Topics: > > 1. (Help) How to replace __multicall__ with hookwrapper? > (Ernesto D. Luzon Jr.) > 2. Re: (Help) How to replace __multicall__ with hookwrapper? > (holger krekel) > 3. Re: (Help) How to replace __multicall__ with hookwrapper? > (holger krekel) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 22 Sep 2015 20:27:06 +0100 > From: "Ernesto D. Luzon Jr." <[email protected]> > To: [email protected] > Subject: [pytest-dev] (Help) How to replace __multicall__ with > hookwrapper? > Message-ID: > < > caeptn6dn-vrkhhaq7oykp9wjyvhc7g4pv-wsv5hqa2yzwcy...@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > 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! > > Many thanks, > Ernesto D. Luzon Jr. > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/pytest-dev/attachments/20150922/233d63f0/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Tue, 22 Sep 2015 19:31:31 +0000 > From: holger krekel <[email protected]> > To: "Ernesto D. Luzon Jr." <[email protected]> > Cc: [email protected] > Subject: Re: [pytest-dev] (Help) How to replace __multicall__ with > hookwrapper? > Message-ID: <[email protected]> > Content-Type: text/plain; charset=us-ascii > > 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 > > > ------------------------------ > > Message: 3 > Date: Tue, 22 Sep 2015 19:44:07 +0000 > From: holger krekel <[email protected]> > To: holger krekel <[email protected]>, "Ernesto D. Luzon Jr." > <[email protected]>, [email protected] > Subject: Re: [pytest-dev] (Help) How to replace __multicall__ with > hookwrapper? > Message-ID: <[email protected]> > Content-Type: text/plain; charset=us-ascii > > On Tue, Sep 22, 2015 at 19:31 +0000, holger krekel wrote: > > 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 > > This should rather read @pytest.hookimpl(hookwrapper=True) like stated in > the documentation. > > holger > > > 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 > > > > -- > about me: http://holgerkrekel.net/about-me/ > contracting: http://merlinux.eu > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > pytest-dev mailing list > [email protected] > https://mail.python.org/mailman/listinfo/pytest-dev > > > ------------------------------ > > End of pytest-dev Digest, Vol 34, Issue 16 > ****************************************** >
_______________________________________________ pytest-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/pytest-dev
