]> arthur.barton.de Git - bup.git/commitdiff
Add bup map including test results to pytest items
authorRob Browning <rlb@defaultvalue.org>
Tue, 17 Nov 2020 01:52:42 +0000 (19:52 -0600)
committerRob Browning <rlb@defaultvalue.org>
Thu, 26 Nov 2020 21:53:09 +0000 (15:53 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
conftest.py

index 14cf647bf6ed6bacd6b56c6ac274d6188019d45d..0507a79626e6ae544c6b6624b96e0c0625589848 100644 (file)
@@ -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'):