From: Rob Browning Date: Tue, 17 Nov 2020 01:52:42 +0000 (-0600) Subject: Add bup map including test results to pytest items X-Git-Tag: 0.32~21^2~3 X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=1fdd55c6e25fa3c4563d5391f50684318139d07a Add bup map including test results to pytest items Signed-off-by: Rob Browning --- diff --git a/conftest.py b/conftest.py index 14cf647..0507a79 100644 --- a/conftest.py +++ b/conftest.py @@ -21,6 +21,15 @@ _bup_src_top = realpath(dirname(fsencode(__file__))) # https://groups.google.com/forum/#!topic/bup-list/9ke-Mbp10Q0 os.chdir(realpath(os.getcwd())) +# Make the test results available to fixtures +@pytest.hookimpl(tryfirst=True, hookwrapper=True) +def pytest_runtest_makereport(item, call): + other_hooks = yield + report = other_hooks.get_result() + bup = item.__dict__.setdefault('bup', {}) + bup[report.when + '_report'] = report # setup, call, teardown + item.bup = bup + def bup_test_sort_order(item): # Pull some slower tests forward to speed parallel runs if item.fspath.basename in ('test_get.py', 'test-index.sh'):