aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-01-11 19:00:48 +0100
committerGuido Günther <agx@sigxcpu.org>2017-01-11 19:00:48 +0100
commit734143b4e0a53a044a20a569ed41632cc90ff360 (patch)
treeb90293f83ccc0511f309edc6e743e7d5265d8461
parent80a1c39abf60d09bb6b8e033350b06ac789726cf (diff)
gbplogtester: allow to match anywhere in the log
-rw-r--r--tests/testutils/gbplogtester.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/testutils/gbplogtester.py b/tests/testutils/gbplogtester.py
index 6bb173f4..30487da2 100644
--- a/tests/testutils/gbplogtester.py
+++ b/tests/testutils/gbplogtester.py
@@ -57,6 +57,18 @@ class GbpLogTester(object):
ok_(re.match(regex, output),
"Log entry '%s' doesn't match '%s'" % (output, regex))
+ def _check_in_log(self, regex):
+ """Check that the at least one line on log matches expectations"""
+ found = False
+ if self._log is None:
+ raise Exception("BUG in unittests: no log captured!")
+ log = self._get_log()
+ for line in log:
+ if re.match(regex, line):
+ found = True
+ break
+ ok_(found, "No line of %s matched '%s'" % (log, regex))
+
def _clear_log(self):
"""Clear the mock strerr"""
if self._log is not None: