Skip to content

Commit 2004149

Browse files
committed
Update test
1 parent 78c478a commit 2004149

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

sphinx/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import re
44
import traceback
55
import types
6-
import warnings
76
from collections import OrderedDict
87
from os import getenv, path
98
from typing import (TYPE_CHECKING, Any, Callable, Dict, Generator, Iterator, List, NamedTuple,

tests/test_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ def test_conf_py_language_none(tempdir):
397397
assert cfg.language == "en"
398398

399399

400-
def test_conf_py_language_none_warning(tempdir, caplog):
400+
@mock.patch("sphinx.config.logger")
401+
def test_conf_py_language_none_warning(logger, tempdir):
401402
"""Regression test for #10474."""
402403

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

409410
# Then a warning is raised
410-
assert len(caplog.messages) == 1
411-
assert caplog.messages[0] == (
411+
assert logger.warning.called
412+
assert logger.warning.call_args[0][0] == (
412413
"Invalid configuration value found: 'language = None'. "
413414
"Update your configuration to a valid langauge code. "
414415
"Falling back to 'en' (English).")
415-
assert caplog.records[0].levelname == "WARNING"
416416

417417

418418
def test_conf_py_no_language(tempdir):

0 commit comments

Comments
 (0)