summaryrefslogtreecommitdiff
path: root/docutils/test
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-08-26 12:09:23 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-08-26 12:09:23 +0000
commit08af9b25a2e33f4c70bda60caa8a8ac53a36ee86 (patch)
tree715007fbcb76fc7154704f4cda2ebb5c9d35b447 /docutils/test
parentea4822af45d597b91ecee09ee2e03167a54a3998 (diff)
downloaddocutils-08af9b25a2e33f4c70bda60caa8a8ac53a36ee86.tar.gz
Remove unused lxml import blocks
These have been commented out for over 10 years [1] and aren't coming back. Remove them along with checks for the 'xml' library, which is present in all versions of Python we support. [1] https://sourceforge.net/p/docutils/code/5846/ Signed-off-by: Stephen Finucane <stephen@that.guru> git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8337 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test')
-rwxr-xr-xdocutils/test/test_writers/test_odt.py40
1 files changed, 3 insertions, 37 deletions
diff --git a/docutils/test/test_writers/test_odt.py b/docutils/test/test_writers/test_odt.py
index 195b8d214..4dcb784ec 100755
--- a/docutils/test/test_writers/test_odt.py
+++ b/docutils/test/test_writers/test_odt.py
@@ -30,11 +30,9 @@ Instructions for adding a new test:
"""
-import sys
import os
import zipfile
-import xml.etree.ElementTree as ET
-import tempfile
+import xml.etree.ElementTree as etree
from __init__ import DocutilsTestSupport
@@ -49,41 +47,9 @@ INPUT_PATH = 'functional/input/'
EXPECTED_PATH = 'functional/expected/'
class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase):
- #
- # Check to see if we can import the needed XML library.
- # Report failure if we cannot.
- def check_import(self):
- WhichElementTree = ''
- try:
- # 1. Try to use lxml.
- #from lxml import etree
- #WhichElementTree = 'lxml'
- raise ImportError('Ignoring lxml')
- except ImportError as e:
- try:
- # 2. Try to use ElementTree from the Python standard library.
- from xml.etree import ElementTree as etree
- WhichElementTree = 'elementtree'
- except ImportError as e:
- try:
- # 3. Try to use a version of ElementTree installed as a separate
- # product.
- from elementtree import ElementTree as etree
- WhichElementTree = 'elementtree'
- except ImportError as e:
- s1 = '\nSkipped test of odf_odt writer. ' \
- 'In order to test odf_odt writer ' \
- 'must install either a version of Python containing ' \
- 'ElementTree (Python version >=2.5) or ' \
- 'install ElementTree.\n\n'
- #self.fail(s1)
- sys.stderr.write(s1)
- return WhichElementTree
def process_test(self, input_filename, expected_filename,
save_output_name=None, settings_overrides=None):
- if not self.check_import():
- return
# Test that xmlcharrefreplace is the default output encoding
# error handler.
input_file = open(INPUT_PATH + input_filename, 'rb')
@@ -135,10 +101,10 @@ class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase):
payloadfile.seek(0)
zfile = zipfile.ZipFile(payloadfile, 'r')
content1 = zfile.read(filename)
- doc = ET.fromstring(content1)
+ doc = etree.fromstring(content1)
self.reorder_attributes(doc)
#content2 = doc.toprettyxml(indent=' ')
- content2 = ET.tostring(doc)
+ content2 = etree.tostring(doc)
return content2
def assertEqual(self, first, second, msg=None):