From 73e89df9129e4539ad3a311b2d65991c66fc138d Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 5 Jul 2018 23:04:38 +0200 Subject: [PATCH] amend to bcf557990e15922aff22485cc86ddd2fcf41b796: wrong logging syntax will not throw an error anymore (logged now, as logging is safe) --- fail2ban/tests/misctestcase.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fail2ban/tests/misctestcase.py b/fail2ban/tests/misctestcase.py index 1e75fb95..cd27ad92 100644 --- a/fail2ban/tests/misctestcase.py +++ b/fail2ban/tests/misctestcase.py @@ -416,13 +416,10 @@ class TestsUtilsTest(LogCaptureTestCase): def testLazyLogging(self): logSys = DefLogSys - if unittest.F2B.log_lazy: - # wrong logging syntax will throw an error lazy (on demand): - logSys.debug('test', 1, 2, 3) - self.assertRaisesRegexp(Exception, 'not all arguments converted', lambda: self.assertNotLogged('test')) - else: # pragma: no cover - # wrong logging syntax will throw an error directly: - self.assertRaisesRegexp(Exception, 'not all arguments converted', lambda: logSys.debug('test', 1, 2, 3)) + logSys.debug('lazy logging: %r', unittest.F2B.log_lazy) + # wrong logging syntax will don't throw an error anymore (logged now): + logSys.notice('test', 1, 2, 3) + self.assertLogged('not all arguments converted') class MyTimeTest(unittest.TestCase):