From 40318ee61cd1ad384d6ecae2ace8d3e734cfc7d7 Mon Sep 17 00:00:00 2001 From: goodger Date: Fri, 17 Jun 2005 22:23:45 +0000 Subject: fixed path bug git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3508 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test_rst/test_directives/test_include.py | 41 +++++++--------------- 1 file changed, 12 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/test_parsers/test_rst/test_directives/test_include.py b/test/test_parsers/test_rst/test_directives/test_include.py index f7280a3d4..cf6ada106 100755 --- a/test/test_parsers/test_rst/test_directives/test_include.py +++ b/test/test_parsers/test_rst/test_directives/test_include.py @@ -11,17 +11,14 @@ Tests for misc.py "include" directive. """ import os.path -import re import sys +from docutils.parsers.rst import states from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) - s.addTestCase( - SpecialIncludeTestCase, 'test_parser', - SpecialIncludeTestCase.input, SpecialIncludeTestCase.expected_regex) return s mydir = 'test_parsers/test_rst/test_directives/' @@ -36,8 +33,10 @@ include11 = os.path.join(mydir, 'include 11.txt') include11rel = DocutilsTestSupport.utils.relative_path(None, include11) utf_16_file = os.path.join(mydir, 'utf-16.csv') utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file) +nonexistent = os.path.join(os.path.dirname(states.__file__), + 'include', 'nonexistent') nonexistent_rel = DocutilsTestSupport.utils.relative_path( - None, '../docutils/parsers/rst/include/nonexistent') + os.path.join(DocutilsTestSupport.testroot, 'dummy'), nonexistent) totest = {} @@ -377,39 +376,23 @@ Standard include data file: \\u03dd """], -] - - -class SpecialIncludeTestCase(DocutilsTestSupport.ParserTestCase): - - def test_parser(self): - if self.run_in_debugger: - pdb.set_trace() - document = DocutilsTestSupport.utils.new_document( - 'test data', self.settings) - # Remove any additions made by "role" directives: - DocutilsTestSupport.roles._roles = {} - self.parser.parse(self.input, document) - output = document.pformat() - self.assert_(re.match(self.expected_regex, output), "Real output:\n" + - output + "\nExpected output:\n" + self.expected_regex) - - input = """\ +["""\ Nonexistent standard include data file: .. include:: -""" - expected_regex = \ -r"""^ +""", +"""\ + Nonexistent standard include data file: Problems with "include" directive path: - IOError: \[Errno 2\] No such file or directory: .*\. + IOError: [Errno 2] No such file or directory: '%s'. - \.\. include:: -$""" + .. include:: +""" % nonexistent_rel], +] # Skip tests whose output contains "UnicodeDecodeError" if we are not -- cgit v1.2.1