Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/iris/mesh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@
]

# Configure the logger as a root logger.
logger = get_logger(__name__, fmt="[%(cls)s.%(funcName)s]", level="NOTSET")
logger = get_logger(
__name__, fmt="[%(cls)s.%(funcName)s]", level="NOTSET", propagate=True
)
25 changes: 13 additions & 12 deletions lib/iris/tests/_shared_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,19 +598,20 @@ def assert_logs(caplog, logger=None, level=None, msg_regex=None):
just to check that there are no formatting errors.

"""
caplog_count = len(caplog.records)
with caplog.at_level(level, logger.name):
assert len(caplog.records) != 0
# Check for any formatting errors by running all the formatters.
for record in caplog.records:
for handler in caplog.logger.handlers:
handler.format(record)

# Check message, if requested.
if msg_regex:
assert len(caplog.records) == 1
rec = caplog.records[0]
assert level == rec.levelname
assert re.match(msg_regex, rec.msg)
yield

assert len(caplog.records) > caplog_count
# Check for any formatting errors by running all the formatters.
for record in caplog.records:
caplog.handler.format(record)

# Check message, if requested.
if msg_regex:
rec = caplog.records[-1]
assert level == rec.levelname
assert re.match(msg_regex, rec.msg)


@contextlib.contextmanager
Expand Down
Loading
Loading