@@ -534,23 +534,24 @@ case we just write some informations out to a ``failures`` file::
534
534
import pytest
535
535
import os.path
536
536
537
- @pytest.hookimpl(tryfirst=True)
538
- def pytest_runtest_makereport(item, call, __multicall__ ):
537
+ @pytest.hookimpl(tryfirst=True, hookwrapper=True )
538
+ def pytest_runtest_makereport(item, call):
539
539
# execute all other hooks to obtain the report object
540
- rep = __multicall__.execute()
540
+ outcome = yield
541
+ rep = outcome.get_result()
541
542
542
543
# we only look at actual failing test calls, not setup/teardown
543
544
if rep.when == "call" and rep.failed:
544
545
mode = "a" if os.path.exists("failures") else "w"
545
546
with open("failures", mode) as f:
546
547
# let's also access a fixture for the fun of it
547
- if "tmpdir" in item.funcargs :
548
+ if "tmpdir" in item.fixturenames :
548
549
extra = " (%s)" % item.funcargs["tmpdir"]
549
550
else:
550
551
extra = ""
551
552
552
553
f.write(rep.nodeid + extra + "\n")
553
- return rep
554
+
554
555
555
556
if you then have failing tests::
556
557
@@ -606,16 +607,16 @@ here is a little example implemented via a local plugin::
606
607
607
608
import pytest
608
609
609
- @pytest.hookimpl(tryfirst=True)
610
- def pytest_runtest_makereport(item, call, __multicall__ ):
610
+ @pytest.hookimpl(tryfirst=True, hookwrapper=True )
611
+ def pytest_runtest_makereport(item, call):
611
612
# execute all other hooks to obtain the report object
612
- rep = __multicall__.execute()
613
+ outcome = yield
614
+ rep = outcome.get_result()
613
615
614
616
# set an report attribute for each phase of a call, which can
615
617
# be "setup", "call", "teardown"
616
618
617
619
setattr(item, "rep_" + rep.when, rep)
618
- return rep
619
620
620
621
621
622
@pytest.fixture
0 commit comments