diff tests/conftest.py @ 39:a6bc019ac0b2 upstream

ADD: PyMuPDF v1.26.5: the original sdist.
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 11 Oct 2025 11:19:58 +0200
parents 1d09e1dec1d9
children
line wrap: on
line diff
--- a/tests/conftest.py	Mon Sep 15 11:43:07 2025 +0200
+++ b/tests/conftest.py	Sat Oct 11 11:19:58 2025 +0200
@@ -77,11 +77,25 @@
     # Allow post-test checking that pymupdf._globals has not changed.
     _globals_pre = get_members(pymupdf._globals)
     
+    testsfailed_before = request.session.testsfailed
+    
     # Run the test.
     rep = yield
     
     sys.stdout.flush()
     
+    # This seems the only way for us to tell that a test has failed. In
+    # particular, <rep> is always None. We're implicitly relying on tests not
+    # being run in parallel.
+    #
+    failed = request.session.testsfailed - testsfailed_before
+    assert failed in (0, 1)
+    
+    if failed:
+        # Do not check post-test conditions if the test as failed. This avoids
+        # additional confusing `ERROR` status for failed tests.
+        return
+    
     # Test has run; check it did not create any MuPDF warnings etc.
     wt = pymupdf.TOOLS.mupdf_warnings()
     if not hasattr(pymupdf, 'mupdf'):