From 09db73f8034ec4b41ba13d94e78d39ee6a6afef5 Mon Sep 17 00:00:00 2001 From: milde Date: Mon, 4 Jun 2012 20:14:08 +0000 Subject: Fix [ 3527842 ]. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- docutils/test/DocutilsTestSupport.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'docutils/test/DocutilsTestSupport.py') 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 = ('\n') standard_generator_template = ( -- cgit v1.2.1