Fix #1815: linkcheck does not raise an exception if warniserror set to true and link is broken

This commit is contained in:
Takeshi KOMIYA 2016-01-03 20:12:33 +09:00
parent c305f30ae4
commit 2bcf92dfb0
3 changed files with 7 additions and 4 deletions

View File

@ -25,6 +25,7 @@ Bugs fixed
* #2206: Fix Sphinx latex doc build failed due to a footnotes
* #2201: Fix wrong table caption for tables with over 30 rows
* #2213: Set <blockquote> in the classic theme to fit with <p>
* #1815: Fix linkcheck does not raise an exception if warniserror set to true and link is broken
Release 1.3.3 (released Dec 2, 2015)
====================================

View File

@ -243,11 +243,12 @@ class CheckExternalLinksBuilder(Builder):
elif status == 'working':
self.info(darkgreen('ok ') + uri + info)
elif status == 'broken':
self.info(red('broken ') + uri + red(' - ' + info))
self.write_entry('broken', docname, lineno, uri + ': ' + info)
if self.app.quiet:
if self.app.quiet or self.app.warningiserror:
self.warn('broken link: %s' % uri,
'%s:%s' % (self.env.doc2path(docname), lineno))
else:
self.info(red('broken ') + uri + red(' - ' + info))
elif status == 'redirected':
text, color = {
301: ('permanently', darkred),

View File

@ -262,9 +262,10 @@ Results of doctest builder run on %s
self.outfile.write(text)
def _warn_out(self, text):
self.info(text, nonl=True)
if self.app.quiet:
if self.app.quiet or self.app.warningiserror:
self.warn(text)
else:
self.info(text, nonl=True)
if isinstance(text, binary_type):
text = force_decode(text, None)
self.outfile.write(text)