Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed May 28, 2022
1 parent 78c478a commit 2004149
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion sphinx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import re
import traceback
import types
import warnings
from collections import OrderedDict
from os import getenv, path
from typing import (TYPE_CHECKING, Any, Callable, Dict, Generator, Iterator, List, NamedTuple,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ def test_conf_py_language_none(tempdir):
assert cfg.language == "en"


def test_conf_py_language_none_warning(tempdir, caplog):
@mock.patch("sphinx.config.logger")
def test_conf_py_language_none_warning(logger, tempdir):
"""Regression test for #10474."""

# Given a conf.py file with language = None
Expand All @@ -407,12 +408,11 @@ def test_conf_py_language_none_warning(tempdir, caplog):
Config.read(tempdir, {}, None)

# Then a warning is raised
assert len(caplog.messages) == 1
assert caplog.messages[0] == (
assert logger.warning.called
assert logger.warning.call_args[0][0] == (
"Invalid configuration value found: 'language = None'. "
"Update your configuration to a valid langauge code. "
"Falling back to 'en' (English).")
assert caplog.records[0].levelname == "WARNING"


def test_conf_py_no_language(tempdir):
Expand Down

0 comments on commit 2004149

Please sign in to comment.