mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-41943: Fix bug where assertLogs doesn't correctly filter messages… (GH-22565)
… by level @vsajip , @pitrou Automerge-Triggered-By: GH:vsajip
This commit is contained in:
parent
aca67da4fe
commit
6fdfcec5b1
3 changed files with 14 additions and 0 deletions
|
@ -1673,6 +1673,18 @@ test case
|
|||
with self.assertLogs(level='WARNING'):
|
||||
log_foo.info("1")
|
||||
|
||||
def testAssertLogsFailureLevelTooHigh_FilterInRootLogger(self):
|
||||
# Failure due to level too high - message propagated to root
|
||||
with self.assertNoStderr():
|
||||
oldLevel = log_foo.level
|
||||
log_foo.setLevel(logging.INFO)
|
||||
try:
|
||||
with self.assertRaises(self.failureException):
|
||||
with self.assertLogs(level='WARNING'):
|
||||
log_foo.info("1")
|
||||
finally:
|
||||
log_foo.setLevel(oldLevel)
|
||||
|
||||
def testAssertLogsFailureMismatchingLogger(self):
|
||||
# Failure due to mismatching logger (and the logged message is
|
||||
# passed through)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue