Commits

Georg Brandl committed a1e6afd Merge

Fix autosummary test suite.

Comments (0)

Files changed (5)

sphinx/ext/autosummary/__init__.py

     genfiles = [path.join(app.srcdir, genfile +
                           (not genfile.endswith(ext) and ext or ''))
                 for genfile in genfiles]
-    generate_autosummary_docs(genfiles, warn=app.warn, info=app.info)
+    generate_autosummary_docs(genfiles, warn=app.warn, info=app.info,
+                              suffix=ext)
 
 
 def setup(app):

sphinx/ext/autosummary/generate.py

 def _simple_warn(msg):
     print >>sys.stderr, 'WARNING: ' + msg
 
-def generate_autosummary_docs(sources, output_dir=None,
+def generate_autosummary_docs(sources, output_dir=None, suffix=None,
                               warn=_simple_warn, info=_simple_info):
     info('generating autosummary for: %s' % ', '.join(sources))
     if output_dir:
             warn('failed to import %r: %s' % (name, e))
             continue
 
-        fn = os.path.join(path, '%s.rst' % name)
+        fn = os.path.join(path, name + (suffix or '.rst'))
         # skip it if it exists
         if os.path.isfile(fn):
             continue
 
 
 def main(argv):
-    usage = 'usage: %s [-o output_dir] sourcefile ...' % sys.argv[0]
+    usage = 'usage: %s [-o output_dir] [-s suffix] sourcefile ...' % sys.argv[0]
     try:
-        opts, args = getopt.getopt(argv[1:], 'o:')
+        opts, args = getopt.getopt(argv[1:], 'o:s:')
     except getopt.error:
         print >>sys.stderr, usage
         return 1
 
     output_dir = None
+    suffix = None
     for opt, val in opts:
         if opt == '-o':
             output_dir = val
+        elif opt == '-s':
+            suffix = val
 
     if len(args) < 1:
         print >>sys.stderr, usage
         return 1
 
-    generate_autosummary_docs(args, output_dir)
+    generate_autosummary_docs(args, output_dir, suffix)
 
 
 if __name__ == '__main__':

tests/root/autosummary.txt

 .. autosummary::
    :toctree: generated
 
-   sphinx.application
+   sphinx.application.TemplateBridge

tests/test_build.py

 
 def teardown_module():
     (test_root / '_build').rmtree()
+    (test_root / 'generated').rmtree()
 
 
 html_warnfile = StringIO()
                            'path %s in %s: %r' % (check, path, fname,
                            [node.text for node in nodes]))
 
-@gen_with_app(buildername='html', warning=html_warnfile, tags=['testtag'])
+@gen_with_app(buildername='html', warning=html_warnfile, cleanenv=True,
+              tags=['testtag'])
 def test_html(app):
     app.builder.build_all()
     html_warnings = html_warnfile.getvalue().replace(os.sep, '/')
             yield check_xpath, etree, fname, path, check
 
 
-@with_app(buildername='latex', warning=latex_warnfile)
+@with_app(buildername='latex', warning=latex_warnfile, cleanenv=True)
 def test_latex(app):
     LaTeXTranslator.ignore_missing_images = True
     app.builder.build_all()
 def test_qthelp(app):
     app.builder.build_all()
 
-@with_app(buildername='changes')
+@with_app(buildername='changes', cleanenv=True)
 def test_changes(app):
     app.builder.build_all()

tests/test_markup.py

 
 def verify_re(rst, html_expected, latex_expected):
     document = utils.new_document('test data', settings)
+    document['file'] = 'dummy'
     parser.parse(rst, document)
     for msg in document.traverse(nodes.system_message):
         if msg['level'] == 1:
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.