Update test

This commit is contained in:
Adam Turner 2022-05-28 19:26:13 +01:00
parent 78c478a579
commit 200414982c
2 changed files with 4 additions and 5 deletions

View File

@ -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,

View File

@ -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
@ -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):