mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge in #67 bugfix.
This commit is contained in:
commit
f21769a232
3
CHANGES
3
CHANGES
@ -45,6 +45,9 @@ New features added
|
||||
Release 0.5.1 (in development)
|
||||
==============================
|
||||
|
||||
* #67: Output warnings about failed doctests in the doctest extension
|
||||
even when running in quiet mode.
|
||||
|
||||
* #72: In pngmath, make it possible to give a full path to LaTeX and
|
||||
dvipng on Windows. For that to work, the ``pngmath_latex`` and
|
||||
``pngmath_dvipng`` options are no longer split into command and
|
||||
|
@ -266,12 +266,13 @@ class Builder(object):
|
||||
|
||||
# finish (write static files etc.)
|
||||
self.finish()
|
||||
status = self.app.statuscode == 0 and 'succeeded' or 'finished with problems'
|
||||
if self.app._warncount:
|
||||
self.info(bold('build succeeded, %s warning%s.' %
|
||||
(self.app._warncount,
|
||||
self.info(bold('build %s, %s warning%s.' %
|
||||
(status, self.app._warncount,
|
||||
self.app._warncount != 1 and 's' or '')))
|
||||
else:
|
||||
self.info(bold('build succeeded.'))
|
||||
self.info(bold('build %s.' % status))
|
||||
|
||||
def write(self, build_docnames, updated_docnames, method='update'):
|
||||
if build_docnames is None or build_docnames == ['__all__']:
|
||||
|
@ -184,6 +184,12 @@ Results of doctest builder run on %s
|
||||
self.info(text, nonl=True)
|
||||
self.outfile.write(text)
|
||||
|
||||
def _warn_out(self, text):
|
||||
self.info(text, nonl=True)
|
||||
if self.app.quiet:
|
||||
self.warn(text)
|
||||
self.outfile.write(text)
|
||||
|
||||
def get_target_uri(self, docname, typ=None):
|
||||
return ''
|
||||
|
||||
@ -205,6 +211,9 @@ Doctest summary
|
||||
self.setup_failures, s(self.setup_failures)))
|
||||
self.outfile.close()
|
||||
|
||||
if self.total_failures or self.setup_failures:
|
||||
self.app.statuscode = 1
|
||||
|
||||
sys.path[0:0] = self.config.doctest_path
|
||||
|
||||
def write(self, build_docnames, updated_docnames, method='update'):
|
||||
@ -287,7 +296,7 @@ Doctest summary
|
||||
setup_doctest.globs = ns
|
||||
old_f = self.setup_runner.failures
|
||||
self.type = 'exec' # the snippet may contain multiple statements
|
||||
self.setup_runner.run(setup_doctest, out=self._out,
|
||||
self.setup_runner.run(setup_doctest, out=self._warn_out,
|
||||
clear_globs=False)
|
||||
if self.setup_runner.failures > old_f:
|
||||
# don't run the group
|
||||
@ -297,8 +306,6 @@ Doctest summary
|
||||
test = parser.get_doctest(code[0].code, {},
|
||||
group.name, filename, code[0].lineno)
|
||||
if not test.examples:
|
||||
self._out('WARNING: no examples in doctest block at '
|
||||
+ filename + ', line %s\n' % code[0].lineno)
|
||||
continue
|
||||
for example in test.examples:
|
||||
# apply directive's comparison options
|
||||
@ -320,7 +327,7 @@ Doctest summary
|
||||
# DocTest.__init__ copies the globs namespace, which we don't want
|
||||
test.globs = ns
|
||||
# also don't clear the globs namespace after running the doctest
|
||||
self.test_runner.run(test, out=self._out, clear_globs=False)
|
||||
self.test_runner.run(test, out=self._warn_out, clear_globs=False)
|
||||
|
||||
|
||||
def setup(app):
|
||||
|
Loading…
Reference in New Issue
Block a user