1.1 --- a/test_all.py Sat Jun 29 21:12:51 2013 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,61 +0,0 @@
1.4 -#!/usr/bin/env python
1.5 -
1.6 -import sys
1.7 -import os
1.8 -from glob import glob
1.9 -import operator
1.10 -
1.11 -libdirs = [
1.12 - os.path.join(os.path.split(__file__)[0], "lib"),
1.13 - "/usr/share/micropython/lib"
1.14 - ]
1.15 -
1.16 -# Main program.
1.17 -
1.18 -if __name__ == "__main__":
1.19 - args = sys.argv[1:]
1.20 - path = libdirs + sys.path[:]
1.21 - path.append("tests")
1.22 -
1.23 - # Process all tests.
1.24 -
1.25 - try:
1.26 - _f = args.index("-f")
1.27 - filenames = args[_f+1:]
1.28 - args = args[:_f]
1.29 - except ValueError:
1.30 - filenames = glob(os.path.join("tests", "*.py"))
1.31 -
1.32 - filenames.sort()
1.33 -
1.34 - # Make some arguments for the test program.
1.35 -
1.36 - args.append("-t")
1.37 - if "-tb" not in args:
1.38 - args.append("-exit")
1.39 -
1.40 - results = []
1.41 -
1.42 - for filename in filenames:
1.43 - print "Processing", filename
1.44 - status = os.system("%s test.py %s %s" % (sys.executable, filename, " ".join(args)))
1.45 - if status == 2:
1.46 - print "Interrupted!"
1.47 - break
1.48 -
1.49 - success = status == 0
1.50 - print "Test successful?", success and "Yes" or "No"
1.51 - results.append((filename, success))
1.52 -
1.53 - failed = [result[0] for result in results if not result[1]]
1.54 - if failed:
1.55 - print
1.56 - print "Failed tests:"
1.57 - for filename in failed:
1.58 - print filename
1.59 -
1.60 - print
1.61 - print "All successful?"
1.62 - print reduce(operator.and_, [x[1] for x in results], 1) and "Yes" or "No"
1.63 -
1.64 -# vim: tabstop=4 expandtab shiftwidth=4