Skip to content

Commit 6810b3d

Browse files
tests/conftest.py: Don't mark tests with ERROR if they have failed.
1 parent 868cf48 commit 6810b3d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,25 @@ def get_members(a):
7777
# Allow post-test checking that pymupdf._globals has not changed.
7878
_globals_pre = get_members(pymupdf._globals)
7979

80+
testsfailed_before = request.session.testsfailed
81+
8082
# Run the test.
8183
rep = yield
8284

8385
sys.stdout.flush()
8486

87+
# This seems the only way for us to tell that a test has failed. In
88+
# particular, <rep> is always None. We're implicitly relying on tests not
89+
# being run in parallel.
90+
#
91+
failed = request.session.testsfailed - testsfailed_before
92+
assert failed in (0, 1)
93+
94+
if failed:
95+
# Do not check post-test conditions if the test as failed. This avoids
96+
# additional confusing `ERROR` status for failed tests.
97+
return
98+
8599
# Test has run; check it did not create any MuPDF warnings etc.
86100
wt = pymupdf.TOOLS.mupdf_warnings()
87101
if not hasattr(pymupdf, 'mupdf'):

0 commit comments

Comments
 (0)