summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-06-17 22:23:45 +0000
committergoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-06-17 22:23:45 +0000
commit40318ee61cd1ad384d6ecae2ace8d3e734cfc7d7 (patch)
tree0f96736345702b49750c579682e5b8ca554fdfca
parent70baa3875664998e598f5537ec067826c7143726 (diff)
downloaddocutils-40318ee61cd1ad384d6ecae2ace8d3e734cfc7d7.tar.gz
fixed path bug
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3508 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rwxr-xr-xtest/test_parsers/test_rst/test_directives/test_include.py41
1 files changed, 12 insertions, 29 deletions
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:
<substitution_definition names="b.gammad">
\\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:: <nonexistent>
-"""
- expected_regex = \
-r"""^<document source="test data">
+""",
+"""\
+<document source="test data">
<paragraph>
Nonexistent standard include data file:
<system_message level="4" line="3" source="test data" type="SEVERE">
<paragraph>
Problems with "include" directive path:
- IOError: \[Errno 2\] No such file or directory: .*\.
+ IOError: [Errno 2] No such file or directory: '%s'.
<literal_block xml:space="preserve">
- \.\. include:: <nonexistent>
-$"""
+ .. include:: <nonexistent>
+""" % nonexistent_rel],
+]
# Skip tests whose output contains "UnicodeDecodeError" if we are not