SF.net SVN: docutils:[10135] trunk/docutils/test/test_writers/ test_html5_polyglot.py
milde--- via Docutils-checkins <[email protected]> Tue, 20 May 2025 15:07:29 +0000
| Newsgroups | gmane.text.docutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 10135
http://sourceforge.net/p/docutils/code/10135
Author: milde
Date: 2025-05-20 15:07:28 +0000 (Tue, 20 May 2025)
Log Message:
-----------
Fixup for [r10134]. Test failure due to varying PIL error messages.
Pillow versions vary in their error output (cf. bugs: #485 and #500)
Use error output from a probe in constant "DUMMY_PNG_NOT_FOUND".
Modified Paths:
--------------
trunk/docutils/test/test_writers/test_html5_polyglot.py
Modified: trunk/docutils/test/test_writers/test_html5_polyglot.py
===================================================================
--- trunk/docutils/test/test_writers/test_html5_polyglot.py 2025-05-19 21:12:34 UTC (rev 10134)
+++ trunk/docutils/test/test_writers/test_html5_polyglot.py 2025-05-20 15:07:28 UTC (rev 10135)
@@ -41,13 +41,11 @@
if PIL:
REQUIRES_PIL = ''
ONLY_LOCAL = 'Cannot get file path corresponding to https://dummy.png.'
- DUMMY_PNG_NOT_FOUND = "[Errno 2] No such file or directory: 'dummy.png'"
- # Pillow reports the absolute path since version 10.3.0 (cf. [bugs: 485])
- # Backported to version 9.1 (or does it depend on the Python version)?
- pil_version = tuple(int(i) for i in PIL.__version__.split('.'))
- if pil_version >= (10, 3) or pil_version[0] == 9 and pil_version[1] >= 1:
- DUMMY_PNG_NOT_FOUND = ("[Errno 2] No such file or directory: '%s'"
- % Path('dummy.png').resolve())
+ # Pillow versions vary in their error output (cf. bugs: #485 and #500)
+ try:
+ PIL.Image.open(Path('dummy.png'))
+ except OSError as err:
+ DUMMY_PNG_NOT_FOUND = str(err)
HEIGHT_ATTR = 'height="32" '
WIDTH_ATTR = 'width="32" '
NO_PIL_SYSTEM_MESSAGE = ''
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.