improve failure-message of assertNotLogged in case of single match given

pull/2171/head
sebres 2018-07-04 17:05:36 +02:00
parent 7c9146feb3
commit 48c2cbfa0b
2 changed files with 4 additions and 2 deletions

View File

@ -304,8 +304,10 @@ class TestsUtilsTest(LogCaptureTestCase):
## assertLogged, assertNotLogged negative case:
self.pruneLog()
logSys.debug('test "xyz"')
self._testAssertionErrorRE(r"All of the .* were found present in the log",
self._testAssertionErrorRE(r".* was found in the log",
self.assertNotLogged, 'test "xyz"')
self._testAssertionErrorRE(r"All of the .* were found present in the log",
self.assertNotLogged, 'test "xyz"', 'test')
self._testAssertionErrorRE(r"was found in the log",
self.assertNotLogged, 'test', 'xyz', all=True)
self._testAssertionErrorRE(r"was not found in the log",

View File

@ -807,7 +807,7 @@ class LogCaptureTestCase(unittest.TestCase):
all : boolean (default False) if True should fail if any of s logged
"""
logged = self._log.getvalue()
if not kwargs.get('all', False):
if len(s) > 1 and not kwargs.get('all', False):
for s_ in s:
if s_ not in logged:
return