Replace deprecated logging.warn() calls with logging.warning()

Replace the deprecated logging.warn() calls with logging.warning().
The former were undocumented, deprecated since Python 3.3 and eventually
removed in Python 3.13.

See: https://docs.python.org/3.13/whatsnew/3.13.html#logging
Partial-Bug: 2069084
Change-Id: I6d1ee13409fe84cd54b7a3aa3ed862bc6e33f1c3
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny 2024-06-11 21:35:58 +02:00
parent 9bee2820a2
commit 60c39a3b87

View File

@ -1115,7 +1115,7 @@ class FancyRecordTestCase(LogTestBase):
self.assertIn(infoexpected, self.stream.getvalue())
self.assertEqual('\033[00;36m', infocolor)
self.colorlog.warn(warn_msg, context=ctxt)
self.colorlog.warning(warn_msg, context=ctxt)
self.assertIn(infoexpected, self.stream.getvalue())
self.assertIn(warnexpected, self.stream.getvalue())
self.assertEqual('\033[01;33m', warncolor)
@ -1266,7 +1266,7 @@ class DomainTestCase(LogTestBase):
self.mylog.info(info_message, context=ctxt)
self.assertEqual(infoexpected, self.stream.getvalue())
self.mylog.warn(warn_message, context=ctxt)
self.mylog.warning(warn_message, context=ctxt)
self.assertEqual(infoexpected + warnexpected, self.stream.getvalue())
def test_domain_in_log_msg(self):
@ -1590,11 +1590,11 @@ keys=
stream = self.set_root_stream()
log = logging.getLogger("a.a")
log.info("info")
log.warn("warn")
log.warning("warn")
self.assertEqual("warn\n", stream.getvalue())
stream = self.set_root_stream()
log.info("info")
log.warn("warn")
log.warning("warn")
self.assertEqual("info\nwarn\n", stream.getvalue())