blob: 507fd239c1662e7f29ff09321bb30c9b39826f00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
diff --git a/test/test_writers/test_html5_polyglot_parts.py b/test/test_writers/test_html5_polyglot_parts.py
index fb2792ee7..cb03fea2f 100644
--- a/test/test_writers/test_html5_polyglot_parts.py
+++ b/test/test_writers/test_html5_polyglot_parts.py
@@ -24,11 +24,20 @@ if __name__ == '__main__':
import docutils
import docutils.core
+from docutils.parsers.rst.directives.images import PIL
from docutils.utils.code_analyzer import with_pygments
ROOT_PREFIX = (Path(__file__).parent.parent/'functional'/'input').as_posix()
DATA_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', 'data'))
+with_pygments = False
+PIL_NOT_FOUND_PATH = 'dummy.png'
+try:
+ if PIL and (tuple(int(i) for i in PIL.__version__.split('.')) >= (10, 3)):
+ PIL_NOT_FOUND_PATH = Path('dummy.png').resolve()
+except:
+ PIL = None
+
class Html5WriterPublishPartsTestCase(unittest.TestCase):
"""Test case for HTML writer via the publish_parts interface."""
@@ -642,14 +651,14 @@ totest['system_messages'] = ({'stylesheet_path': '',
.. image:: dummy.mp4
:scale: 100%
""",
-{'fragment': """\
+{'fragment': f"""\
<img alt="dummy.png" src="dummy.png" />
<aside class="system-message">
<p class="system-message-title">System Message: WARNING/2 \
(<span class="docutils literal"><string></span>, line 1)</p>
<p>Cannot scale image!
Could not get size from "dummy.png":
- [Errno 2] No such file or directory: 'dummy.png'</p>
+ [Errno 2] No such file or directory: '{PIL_NOT_FOUND_PATH}'</p>
</aside>
<aside class="system-message">
<p class="system-message-title">System Message: ERROR/3 \
|