Make WARNING the default warning prefix.

This commit is contained in:
Georg Brandl 2009-03-05 10:06:18 +01:00
parent ed26bfa30e
commit 0d75f37e23
3 changed files with 11 additions and 11 deletions

View File

@ -134,7 +134,7 @@ class Sphinx(object):
self.emit('build-finished', None) self.emit('build-finished', None)
self.builder.cleanup() self.builder.cleanup()
def warn(self, message, location=None, prefix='warning: '): def warn(self, message, location=None, prefix='WARNING: '):
warntext = location and '%s: %s%s\n' % (location, prefix, message) or \ warntext = location and '%s: %s%s\n' % (location, prefix, message) or \
'%s%s\n' % (prefix, message) '%s%s\n' % (prefix, message)
if self.warningiserror: if self.warningiserror:

View File

@ -53,7 +53,7 @@ def test_output():
old_count = app._warncount old_count = app._warncount
app.warn("Bad news!") app.warn("Bad news!")
assert warnings.getvalue() == "warning: Bad news!\n" assert warnings.getvalue() == "WARNING: Bad news!\n"
assert app._warncount == old_count + 1 assert app._warncount == old_count + 1
finally: finally:
app.cleanup() app.cleanup()

View File

@ -38,24 +38,24 @@ html_warnfile = StringIO()
latex_warnfile = StringIO() latex_warnfile = StringIO()
ENV_WARNINGS = """\ ENV_WARNINGS = """\
%(root)s/images.txt:9: warning: image file not readable: foo.png %(root)s/images.txt:9: WARNING: image file not readable: foo.png
%(root)s/images.txt:23: warning: nonlocal image URI found: \ %(root)s/images.txt:23: WARNING: nonlocal image URI found: \
http://www.python.org/logo.png http://www.python.org/logo.png
%(root)s/includes.txt:: (WARNING/2) Encoding 'utf-8' used for reading \ %(root)s/includes.txt:: (WARNING/2) Encoding 'utf-8' used for reading \
included file u'wrongenc.inc' seems to be wrong, try giving an :encoding: option included file u'wrongenc.inc' seems to be wrong, try giving an :encoding: option
%(root)s/includes.txt:56: warning: download file not readable: nonexisting.png %(root)s/includes.txt:56: WARNING: download file not readable: nonexisting.png
""" """
HTML_WARNINGS = ENV_WARNINGS + """\ HTML_WARNINGS = ENV_WARNINGS + """\
%(root)s/images.txt:20: warning: no matching candidate for image URI u'foo.*' %(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.*'
%(root)s/markup.txt:: warning: invalid index entry u'' %(root)s/markup.txt:: WARNING: invalid index entry u''
%(root)s/markup.txt:: warning: invalid pair index entry u'' %(root)s/markup.txt:: WARNING: invalid pair index entry u''
%(root)s/markup.txt:: warning: invalid pair index entry u'keyword; ' %(root)s/markup.txt:: WARNING: invalid pair index entry u'keyword; '
""" """
LATEX_WARNINGS = ENV_WARNINGS + """\ LATEX_WARNINGS = ENV_WARNINGS + """\
None:None: warning: no matching candidate for image URI u'foo.*' None:None: WARNING: no matching candidate for image URI u'foo.*'
warning: invalid pair index entry u'' WARNING: invalid pair index entry u''
""" """
HTML_XPATH = { HTML_XPATH = {