make output comparisons regex

This commit is contained in:
Gregory Becker
2020-04-24 09:55:21 -07:00
committed by Tamara Dahlgren
parent 5ff9ba320d
commit bca630a22a

View File

@@ -1676,7 +1676,8 @@ def run_test(self, exe, options=[], expected=[], status=None,
Args:
exe (str): the name of the executable
options (list of str): list of options to pass to the runner
expected (list of str): list of expected output strings
expected (list of str): list of expected output strings. Each
string is a regex expected to match part of the output.
status (int, list of int, or None): possible passing status values
with 0 and None meaning the test is expected to succeed
installed (bool): the executable must be in the install prefix
@@ -1759,9 +1760,9 @@ def _run_test_helper(self, exe, options, expected, status, installed,
for check in expected:
cmd = ' '.join([exe] + options)
msg = "Expected '%s' in output of `%s`" % (check, cmd)
msg = "Expected '%s' to match output of `%s`" % (check, cmd)
msg += '\n\nOutput: %s' % output
assert check in output, msg
assert re.search(check, output), msg
def unit_test_check(self):
"""Hook for unit tests to assert things about package internals.