Georg Brandl avatar Georg Brandl committed 877a4e9

Make test suite work with docutils from trunk: they emit a line number for a warning where 0.6 doesnt.

Comments (0)

Files changed (1)

tests/test_build.py

 %(root)s/images.txt:9: WARNING: image file not readable: foo.png
 %(root)s/images.txt:23: WARNING: nonlocal image URI found: \
 http://www.python.org/logo.png
-%(root)s/includes.txt:: (WARNING/2) Encoding 'utf-8-sig' used for reading \
-included file u'wrongenc.inc' seems to be wrong, try giving an :encoding: option
+%(root)s/includes.txt:\\d*: \\(WARNING/2\\) Encoding 'utf-8-sig' used for \
+reading included file u'wrongenc.inc' seems to be wrong, try giving an \
+:encoding: option
 %(root)s/includes.txt:4: WARNING: download file not readable: nonexisting.png
 """
 
 HTML_WARNINGS = ENV_WARNINGS + """\
-%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.*'
+%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
 %(root)s/markup.txt:: WARNING: invalid index entry u''
 %(root)s/markup.txt:: WARNING: invalid pair index entry u''
 %(root)s/markup.txt:: WARNING: invalid pair index entry u'keyword; '
 """
 
 LATEX_WARNINGS = ENV_WARNINGS + """\
-None:None: WARNING: no matching candidate for image URI u'foo.*'
+None:None: WARNING: no matching candidate for image URI u'foo.\\*'
 WARNING: invalid pair index entry u''
 """
 
 def test_html(app):
     app.builder.build_all()
     html_warnings = html_warnfile.getvalue().replace(os.sep, '/')
-    html_warnings_exp = HTML_WARNINGS % {'root': app.srcdir}
-    assert html_warnings == html_warnings_exp, 'Warnings don\'t match:\n' + \
+    html_warnings_exp = HTML_WARNINGS % {'root': re.escape(app.srcdir)}
+    assert re.match(html_warnings_exp + '$', html_warnings), \
+           'Warnings don\'t match:\n' + \
            '\n'.join(difflib.ndiff(html_warnings_exp.splitlines(),
                                    html_warnings.splitlines()))
 
     LaTeXTranslator.ignore_missing_images = True
     app.builder.build_all()
     latex_warnings = latex_warnfile.getvalue().replace(os.sep, '/')
-    latex_warnings_exp = LATEX_WARNINGS % {'root': app.srcdir}
-    assert latex_warnings == latex_warnings_exp, 'Warnings don\'t match:\n' + \
+    latex_warnings_exp = LATEX_WARNINGS % {'root': re.escape(app.srcdir)}
+    assert re.match(latex_warnings_exp + '$', latex_warnings), \
+           'Warnings don\'t match:\n' + \
            '\n'.join(difflib.ndiff(latex_warnings_exp.splitlines(),
                                    latex_warnings.splitlines()))
     # file from latex_additional_files
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.