mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #67: Output warnings about failed doctests in the doctest extension
even when running in quiet mode.
This commit is contained in:
parent
1d8f1f1520
commit
04f02b34d0
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
||||
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
|
||||
|
@ -291,12 +291,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__']:
|
||||
|
@ -181,6 +181,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 ''
|
||||
|
||||
@ -202,6 +208,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'):
|
||||
@ -280,7 +289,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
|
||||
@ -311,7 +320,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