[New-bugs-announce] [issue39385] Add an assertNoLogs context manager to unittest TestCase

Kit Yan Choi report at bugs.python.org
Sat Jan 18 15:25:23 EST 2020


New submission from Kit Yan Choi <kit at kychoi.org>:

assertLogs is really useful (issue18937). Unfortunately it does not cover the use cases where one wants to ensure no logs are emitted.

Similar to assertLogs, we can have a context manager for asserting no logs, something like this?:

with assertNoLogs(logger, level):
    ...


If logs are unexpected found, the test would fail with the logs captured included in the error message.

Happy to submit a PR if there is interest.

----------
components: Library (Lib)
messages: 360250
nosy: Kit Yan Choi
priority: normal
severity: normal
status: open
title: Add an assertNoLogs context manager to unittest TestCase
type: enhancement

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39385>
_______________________________________


More information about the New-bugs-announce mailing list