1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/usr/bin/env jython
import glob
import sys
testdir = sys.argv[1]
orderfiles = glob.glob(testdir + '/*.tests')
# wee. just be glad I didn't make this one gigantic nested listcomp.
# anyway, this builds a once-nested list of files to test.
# open!
files = [open(fn) for fn in orderfiles]
# create prelim list of lists of files!
files = [f.readlines() for f in files]
# shwack newlines and filter out empties!
files = [filter(None, [fn.strip() for fn in fs]) for fs in files]
# prefix with testdir
files = [[testdir + '/' + fn.strip() for fn in fs] for fs in files]
print("Will run these tests:", files)
i = 0
for testlist in files:
print("===========================")
print("running tests from testlist", orderfiles[i])
print("---------------------------")
i = i + 1
for test in testlist:
print("running test", test)
try:
with open(test) as f:
exec(f.read(), globals().copy())
except Exception:
ei = sys.exc_info()
print("TEST FAILURE:", ei[1])
else:
print("SUCCESS")
|