Skip to content

Commit df5503a

Browse files
authored
Merge pull request #1200 from MetOffice/test_log_filtering
Test matplotlib font logs are filtered out
2 parents 5606182 + a808fe5 commit df5503a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_cli.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ def test_setup_logging():
6767
assert root_logger.level == logging.DEBUG
6868

6969

70+
def test_setup_logging_mpl_font_logs_filtered(caplog):
71+
"""Test matplotlib log messages about fonts are filtered out."""
72+
CSET.setup_logging(2)
73+
logger = logging.getLogger("matplotlib.font_manager")
74+
logger.debug("findfont: message")
75+
logger.debug("other message")
76+
assert len(caplog.records) == 1
77+
assert caplog.records[0].getMessage() == "other message"
78+
79+
7080
def test_main_no_subparser(capsys):
7181
"""Appropriate error when no subparser is given."""
7282
with pytest.raises(SystemExit) as sysexit:

0 commit comments

Comments
 (0)