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"""\