Skip to content

Commit 7eb4429

Browse files
committed
statuschecker: updated to latest version with support for testing only the beginning of the error message
1 parent e9ab9aa commit 7eb4429

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎test/statuschecker.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
the expected status to 'FAIL' is done by having word 'FAIL' (in uppercase)
3131
somewhere in the test case documentation. Expected error message must then be
3232
given after 'FAIL'. Error message can also be specified as a regular
33-
expression by prefixing it with string 'REGEXP:'.
33+
expression by prefixing it with string 'REGEXP:'. Testing only the beginning
34+
of the message is possible with 'STARTS:' prefix.
3435
3536
This tool also allows testing the created log messages. They are specified
3637
using a syntax 'LOG x.y:z LEVEL Actual message', which is described in detail
@@ -84,6 +85,10 @@ def _message_matches(actual, expected):
8485
pattern = '^%s$' % expected.replace('REGEXP:', '', 1).strip()
8586
if re.match(pattern, actual, re.DOTALL):
8687
return True
88+
if expected.startswith('STARTS:'):
89+
start = expected.replace('STARTS:', '', 1).strip()
90+
if actual.startswith(start):
91+
return True
8792
return False
8893

8994
def _check_logs(test, exp):

0 commit comments

Comments
 (0)