summaryrefslogtreecommitdiff
path: root/docutils/test/DocutilsTestSupport.py
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2012-06-04 20:14:08 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2012-06-04 20:14:08 +0000
commit09db73f8034ec4b41ba13d94e78d39ee6a6afef5 (patch)
tree2a3610dd2f9cc71c54d29c3b8fc3a32cab5592aa /docutils/test/DocutilsTestSupport.py
parent607b580b989fe944688db4de8a65ea98378eeab2 (diff)
downloaddocutils-09db73f8034ec4b41ba13d94e78d39ee6a6afef5.tar.gz
Fix [ 3527842 ].
Under Python 3, converted tests and tools are now stored in the ``test3/`` and ``tools3/`` sub-directories and not installed in the PYTHONPATH. In order to make this work: - Make tests independent from the location of the ``test/`` directory. - Use converted sources from the ``build/`` directory for tests under Python 3. Remove functional/tests/stylesheet_path_html4css1.py made redunant by functional/tests/math_output_html.py. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7437 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/DocutilsTestSupport.py')
-rw-r--r--docutils/test/DocutilsTestSupport.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/docutils/test/DocutilsTestSupport.py b/docutils/test/DocutilsTestSupport.py
index bbe01a807..82c3391b4 100644
--- a/docutils/test/DocutilsTestSupport.py
+++ b/docutils/test/DocutilsTestSupport.py
@@ -50,9 +50,15 @@ from pprint import pformat
testroot = os.path.abspath(os.path.dirname(__file__) or os.curdir)
os.chdir(testroot)
-sys.path.insert(0, os.path.normpath(os.path.join(testroot, '..')))
+if sys.version_info >= (3,0):
+ sys.path.insert(0, os.path.normpath(os.path.join(testroot,
+ '..', 'build', 'lib')))
+ sys.path.append(os.path.normpath(os.path.join(testroot, '..',
+ 'build', 'lib', 'extras')))
+else:
+ sys.path.insert(0, os.path.normpath(os.path.join(testroot, '..')))
+ sys.path.append(os.path.normpath(os.path.join(testroot, '..', 'extras')))
sys.path.insert(0, testroot)
-sys.path.append(os.path.normpath(os.path.join(testroot, '..', 'extras')))
try:
import difflib
@@ -129,13 +135,13 @@ class StandardTestCase(unittest.TestCase):
# aliases for assertion methods, deprecated since Python 2.7
- failUnlessEqual = assertEquals = assertEqual
+ failUnlessEqual = assertEquals = assertEqual
assertNotEquals = failIfEqual = assertNotEqual
class CustomTestCase(StandardTestCase):
-
+
"""
Helper class, providing extended functionality over unittest.TestCase.
@@ -166,7 +172,7 @@ class CustomTestCase(StandardTestCase):
self.expected = expected
self.run_in_debugger = run_in_debugger
self.suite_settings = suite_settings.copy() or {}
-
+
# Ring your mother.
unittest.TestCase.__init__(self, method_name)
@@ -791,7 +797,7 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase):
# interpolate standard variables:
expected = self.expected % {'version': docutils.__version__}
self.compare_output(self.input, output, expected)
-
+
standard_content_type_template = ('<meta http-equiv="Content-Type"'
' content="text/html; charset=%s" />\n')
standard_generator_template = (