Realized the log/warn/etc stuff really just wanted to be 'use logging, stupid' higher up.

It's possible this fixes my other issues too, and that they are purely a visibility problem.
This commit is contained in:
Jeff Forcier 2017-10-19 15:31:46 -07:00
parent ae97cd5740
commit b3ac99af03
3 changed files with 6 additions and 12 deletions

View file

@ -4,7 +4,6 @@ Tests for the ``releases.util`` module.
These are in the integration suite because they deal with on-disk files.
"""
import logging
import os
from docutils.nodes import document
@ -15,9 +14,6 @@ from releases.models import Release, Issue
from releases.util import get_doctree, parse_changelog
# Mute Sphinx's own logging, as it makes test output quite verbose
logging.getLogger('sphinx').setLevel(logging.ERROR)
support = os.path.join(os.path.dirname(__file__), '_support')
vanilla = os.path.join(support, 'vanilla', 'changelog.rst')
unreleased_bugs = os.path.join(support, 'unreleased_bugs', 'changelog.rst')

View file

@ -2,6 +2,7 @@
Utility functions, such as helpers for standalone changelog parsing.
"""
import logging
import os
from tempfile import mkdtemp
@ -191,7 +192,12 @@ def make_app(**kwargs):
dstdir = kwargs.pop('dstdir', mkdtemp())
doctreedir = kwargs.pop('doctreedir', mkdtemp())
try:
# Sphinx <1.6ish
Sphinx._log = lambda self, message, wfile, nonl=False: None
# Sphinx >=1.6ish. Technically still lets Very Bad Things through,
# unlike the total muting above, but probably OK.
logging.getLogger('sphinx').setLevel(logging.ERROR)
# App API seems to work on all versions so far.
app = Sphinx(
srcdir=srcdir,
confdir=None,

View file

@ -1,5 +1,3 @@
import logging
from docutils.nodes import (
list_item, paragraph,
)
@ -17,12 +15,6 @@ from releases import (
from releases.util import make_app, changelog2dict
# Mute Sphinx's own logging, as it makes test output quite verbose (many
# 'Running Sphinx' / 'loading pickled environment' messages since we recreate
# new app objects each time for a clean context.)
logging.getLogger('sphinx').setLevel(logging.ERROR)
def inliner(app=None):
app = app or make_app()
return Mock(document=Mock(settings=Mock(env=Mock(app=app))))