mirror of
https://github.com/vale981/releases
synced 2025-03-04 17:21:43 -05:00
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:
parent
ae97cd5740
commit
b3ac99af03
3 changed files with 6 additions and 12 deletions
|
@ -4,7 +4,6 @@ Tests for the ``releases.util`` module.
|
||||||
These are in the integration suite because they deal with on-disk files.
|
These are in the integration suite because they deal with on-disk files.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from docutils.nodes import document
|
from docutils.nodes import document
|
||||||
|
@ -15,9 +14,6 @@ from releases.models import Release, Issue
|
||||||
from releases.util import get_doctree, parse_changelog
|
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')
|
support = os.path.join(os.path.dirname(__file__), '_support')
|
||||||
vanilla = os.path.join(support, 'vanilla', 'changelog.rst')
|
vanilla = os.path.join(support, 'vanilla', 'changelog.rst')
|
||||||
unreleased_bugs = os.path.join(support, 'unreleased_bugs', 'changelog.rst')
|
unreleased_bugs = os.path.join(support, 'unreleased_bugs', 'changelog.rst')
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
Utility functions, such as helpers for standalone changelog parsing.
|
Utility functions, such as helpers for standalone changelog parsing.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
|
@ -191,7 +192,12 @@ def make_app(**kwargs):
|
||||||
dstdir = kwargs.pop('dstdir', mkdtemp())
|
dstdir = kwargs.pop('dstdir', mkdtemp())
|
||||||
doctreedir = kwargs.pop('doctreedir', mkdtemp())
|
doctreedir = kwargs.pop('doctreedir', mkdtemp())
|
||||||
try:
|
try:
|
||||||
|
# Sphinx <1.6ish
|
||||||
Sphinx._log = lambda self, message, wfile, nonl=False: None
|
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(
|
app = Sphinx(
|
||||||
srcdir=srcdir,
|
srcdir=srcdir,
|
||||||
confdir=None,
|
confdir=None,
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import logging
|
|
||||||
|
|
||||||
from docutils.nodes import (
|
from docutils.nodes import (
|
||||||
list_item, paragraph,
|
list_item, paragraph,
|
||||||
)
|
)
|
||||||
|
@ -17,12 +15,6 @@ from releases import (
|
||||||
from releases.util import make_app, changelog2dict
|
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):
|
def inliner(app=None):
|
||||||
app = app or make_app()
|
app = app or make_app()
|
||||||
return Mock(document=Mock(settings=Mock(env=Mock(app=app))))
|
return Mock(document=Mock(settings=Mock(env=Mock(app=app))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue