In the following code snippet
import re
# Read the test's output
with open(the_output_file, 'r') as f:
test_output = ''.join(f.readlines())
# Evaluate the regular expression
re.find(the_regex_pattern, test_output)
re.find must be replaced with re.findall and re.MULTILINE should also be used.
CC: @flx42