[Python-checkins] r65526 - in doctools/branches/0.4.x: sphinx/builder.py sphinx/textwriter.py tests/root/conf.py tests/test_build.py tests/util.py

georg.brandl python-checkins at python.org
Mon Aug 4 23:46:41 CEST 2008


Author: georg.brandl
Date: Mon Aug  4 23:46:41 2008
New Revision: 65526

Log:
Let the test suite run the text, linkcheck, and changes builders.


Modified:
   doctools/branches/0.4.x/sphinx/builder.py
   doctools/branches/0.4.x/sphinx/textwriter.py
   doctools/branches/0.4.x/tests/root/conf.py
   doctools/branches/0.4.x/tests/test_build.py
   doctools/branches/0.4.x/tests/util.py

Modified: doctools/branches/0.4.x/sphinx/builder.py
==============================================================================
--- doctools/branches/0.4.x/sphinx/builder.py	(original)
+++ doctools/branches/0.4.x/sphinx/builder.py	Mon Aug  4 23:46:41 2008
@@ -976,6 +976,9 @@
         libchanges = {}
         apichanges = []
         otherchanges = {}
+        if version not in self.env.versionchanges:
+            self.info(bold('no changes in this version.'))
+            return
         self.info(bold('writing summary file...'))
         for type, docname, lineno, module, descname, content in \
                 self.env.versionchanges[version]:

Modified: doctools/branches/0.4.x/sphinx/textwriter.py
==============================================================================
--- doctools/branches/0.4.x/sphinx/textwriter.py	(original)
+++ doctools/branches/0.4.x/sphinx/textwriter.py	Mon Aug  4 23:46:41 2008
@@ -350,6 +350,7 @@
 
     def visit_image(self, node):
         self.add_text('[image]')
+        raise nodes.SkipNode
 
     def visit_transition(self, node):
         indent = sum(self.stateindent)

Modified: doctools/branches/0.4.x/tests/root/conf.py
==============================================================================
--- doctools/branches/0.4.x/tests/root/conf.py	(original)
+++ doctools/branches/0.4.x/tests/root/conf.py	Mon Aug  4 23:46:41 2008
@@ -58,6 +58,7 @@
 # List of directories, relative to source directories, that shouldn't be searched
 # for source files.
 #exclude_dirs = []
+exclude_trees = ['_build']
 
 # If true, '()' will be appended to :func: etc. cross-reference text.
 #add_function_parentheses = True

Modified: doctools/branches/0.4.x/tests/test_build.py
==============================================================================
--- doctools/branches/0.4.x/tests/test_build.py	(original)
+++ doctools/branches/0.4.x/tests/test_build.py	Mon Aug  4 23:46:41 2008
@@ -10,11 +10,12 @@
 """
 
 import os
+import difflib
 import htmlentitydefs
 from StringIO import StringIO
-from etree13 import ElementTree as ET
 
 from util import *
+from etree13 import ElementTree as ET
 
 from sphinx.builder import StandaloneHTMLBuilder, LaTeXBuilder
 
@@ -66,14 +67,17 @@
 def test_html(app):
     app.builder.build_all()
     html_warnings = html_warnfile.getvalue().replace(os.sep, '/')
-    assert html_warnings == HTML_WARNINGS % {'root': app.srcdir}
+    html_warnings_exp = HTML_WARNINGS % {'root': app.srcdir}
+    assert html_warnings == html_warnings_exp, 'Warnings don\'t match:\n' + \
+           '\n'.join(difflib.ndiff(html_warnings_exp.splitlines(),
+                                   html_warnings.splitlines()))
 
     if not ET:
         return
     for fname, paths in HTML_XPATH.iteritems():
         parser = NslessParser()
         parser.entity.update(htmlentitydefs.entitydefs)
-        etree = ET.parse(app.outdir / fname, parser)
+        etree = ET.parse(os.path.join(app.outdir, fname), parser)
         for path, text in paths.iteritems():
             nodes = list(etree.findall(path))
             assert nodes != []
@@ -92,4 +96,22 @@
 def test_latex(app):
     app.builder.build_all()
     latex_warnings = latex_warnfile.getvalue().replace(os.sep, '/')
-    assert latex_warnings == LATEX_WARNINGS % {'root': app.srcdir}
+    latex_warnings_exp = LATEX_WARNINGS % {'root': app.srcdir}
+    assert latex_warnings == latex_warnings_exp, 'Warnings don\'t match:\n' + \
+           '\n'.join(difflib.ndiff(latex_warnings_exp.splitlines(),
+                                   latex_warnings.splitlines()))
+
+
+# just let the remaining ones run for now
+
+ at with_testapp(buildername='linkcheck')
+def test_linkcheck(app):
+    app.builder.build_all()
+
+ at with_testapp(buildername='text')
+def test_text(app):
+    app.builder.build_all()
+
+ at with_testapp(buildername='changes')
+def test_changes(app):
+    app.builder.build_all()

Modified: doctools/branches/0.4.x/tests/util.py
==============================================================================
--- doctools/branches/0.4.x/tests/util.py	(original)
+++ doctools/branches/0.4.x/tests/util.py	Mon Aug  4 23:46:41 2008
@@ -130,10 +130,10 @@
 
     def cleanup(self):
         trees = [self.outdir, self.doctreedir]
-        #f self.made_builddir:
-        #    trees.append(self.builddir)
-        #for tree in trees:
-        #    shutil.rmtree(tree, True)
+        if self.made_builddir:
+            trees.append(self.builddir)
+        for tree in trees:
+            shutil.rmtree(tree, True)
 
 
 def with_testapp(*args, **kwargs):


More information about the Python-checkins mailing list