memgraph/filter_failing_scenarios

29 lines
882 B
Plaintext
Raw Normal View History

#!/usr/bin/env python3
'''
Filters failing scenarios from a tck test run and prints them to stdout.
'''
from argparse import ArgumentParser
import sys
def main():
argp = ArgumentParser(description=__doc__)
argp.add_argument('test_log', metavar='TEST_LOG', type=str,
help='Path to the log of a tck test run')
args = argp.parse_args()
with open(args.test_log) as f:
scenario_failed = False
scenario_lines = []
for line in f:
if line.strip().startswith('Scenario:'):
if scenario_failed:
print(''.join(scenario_lines))
scenario_failed = False
scenario_lines.clear()
if line.strip().startswith('AssertionError'):
scenario_failed = True
scenario_lines.append(line)
if __name__ == '__main__':
main()