SF.net SVN: docutils:[9965 ] trunk/docutils/test/funct ional/tests/length_units_htm l5.py

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9965
          http://sourceforge.net/p/docutils/code/9965
Author:   milde
Date:     2024-10-22 21:41:16 +0000 (Tue, 22 Oct 2024)
Log Message:
-----------
Skip functional test that requires PIL if PIL is absent.

For Docutils, PIL is a recommendation, no requirement.

It is, however, required for the extraction of the image size
from an image file and a warning is written if it it missing.
This makes the output differ from the "expected" sample on
a functional test where the "scale" option of the "image"
directive is used.

The "length_units_html5" functional test is intended to provide
an example of the length unit support for visual inspection with
a HTML browser.  There are additional unit tests for the
"scale" option with and without PIL, so we can safely skip
the functional test if PIL is missing on a system.

Modified Paths:
--------------
    trunk/docutils/test/functional/tests/length_units_html5.py

Modified: trunk/docutils/test/functional/tests/length_units_html5.py
===================================================================
--- trunk/docutils/test/functional/tests/length_units_html5.py	2024-10-22 16:51:31 UTC (rev 9964)
+++ trunk/docutils/test/functional/tests/length_units_html5.py	2024-10-22 21:41:16 UTC (rev 9965)
@@ -1,3 +1,11 @@
+import unittest
+# PIL is optional but required with the "image" directive's "scale" option
+from docutils.parsers.rst.directives.images import PIL
+if PIL is None:
+    raise unittest.SkipTest('requires PIL')
+else:
+    del unittest, PIL  # clean up namespace
+
 # Source and destination file names
 test_source = "length_units.rst"
 test_destination = "length_units_html5.html"

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.