memgraph/filter_failing_scenarios
Teon Banek cee2405f85 Add a script for filtering failed tck scenarios
Reviewers: buda, mislav.bradac, matej.gradicek

Reviewed By: buda, mislav.bradac, matej.gradicek

Differential Revision: https://phabricator.memgraph.io/D361
2017-05-12 09:50:18 +01:00

29 lines
882 B
Python
Executable File

#!/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()