Translated using Weblate (Latvian)
[phpmyadmin.git] / scripts / phpunit-top-tests
blob975fc11c6c9edc6e18fe00921e46faee2dac9055
1 #!/usr/bin/env python
2 """
3 Prints 10 longest lasting tests from JSON PHPUnit log
4 """
6 from __future__ import print_function
8 import json
9 import sys
11 def main(filename):
12 with open(filename) as handle:
13 content = handle.read()
14 data = json.loads(
15 '[' + content.replace('}{', '},{') + ']'
17 printed = ['test', 'status', 'time']
18 tests = [item for item in data if item['event'] == 'test']
19 for test in sorted(tests, key=lambda item: -item['time'])[:10]:
20 for item in printed:
21 print('{0:10s}: {1}'.format(item, test[item]))
22 print()
25 if __name__ == '__main__':
26 main(*sys.argv[1:])