From bf72acb3c7fb89e03e82abffeec5d69643295017 Mon Sep 17 00:00:00 2001 From: Ask Hjorth Larsen <asklarsen@gmail.com> Date: Fri, 30 Sep 2016 18:36:53 +0200 Subject: [PATCH] script to run tests --- parser/parser-gulp/runtests.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 parser/parser-gulp/runtests.py diff --git a/parser/parser-gulp/runtests.py b/parser/parser-gulp/runtests.py new file mode 100755 index 0000000..10b312c --- /dev/null +++ b/parser/parser-gulp/runtests.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +from __future__ import print_function +from glob import glob +import re +from optparse import OptionParser +from subprocess import Popen, PIPE +import os + +p = OptionParser() +opts, args = p.parse_args() + +if len(args) == 0: + testfiles = glob('test/outputs/example*.got') + testfiles.sort() + + #tests = {} + + #testfiles.sort() + #print(testfiles) + + #pat = re.compile('test/outputs/example(\d+)[ab]?.got') + + #for fname in testfiles: + # print(fname, pat.match(fname)) + #testfiles.sort(key=lambda fname: + # int(pat.match(fname).group(1))) + #for f in testfiles: + # print(f) +else: + testfiles = argv + +for testfile in testfiles: + dirname, basename = os.path.split(testfile) + print(basename) + args = 'python main.py --annotate'.split() + args.append(testfile) + proc = Popen(args, stdout=PIPE) + txt = proc.stdout.read() + with open('%s.json' % testfile, 'w') as fd: + fd.write(txt) -- GitLab