Mercurial > hgrepos > Python2 > PyMuPDF
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 2:b50eed0cc0ef | 39:a6bc019ac0b2 |
|---|---|
| 75 return ret | 75 return ret |
| 76 | 76 |
| 77 # Allow post-test checking that pymupdf._globals has not changed. | 77 # Allow post-test checking that pymupdf._globals has not changed. |
| 78 _globals_pre = get_members(pymupdf._globals) | 78 _globals_pre = get_members(pymupdf._globals) |
| 79 | 79 |
| 80 testsfailed_before = request.session.testsfailed | |
| 81 | |
| 80 # Run the test. | 82 # Run the test. |
| 81 rep = yield | 83 rep = yield |
| 82 | 84 |
| 83 sys.stdout.flush() | 85 sys.stdout.flush() |
| 86 | |
| 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 | |
| 84 | 98 |
| 85 # Test has run; check it did not create any MuPDF warnings etc. | 99 # Test has run; check it did not create any MuPDF warnings etc. |
| 86 wt = pymupdf.TOOLS.mupdf_warnings() | 100 wt = pymupdf.TOOLS.mupdf_warnings() |
| 87 if not hasattr(pymupdf, 'mupdf'): | 101 if not hasattr(pymupdf, 'mupdf'): |
| 88 print(f'Not checking mupdf_warnings on classic.') | 102 print(f'Not checking mupdf_warnings on classic.') |
