micropython

test_all.py

409:bcdd14822a46
2011-03-23 Paul Boddie Made ObjectSet more usable as a set member and as a collection. Store products of ObjectSet instances in a set, not a list. Fixed the HTML generation to show attribute types again.
     1 #!/usr/bin/env python     2      3 import sys     4 import os     5 from glob import glob     6 import operator     7      8 libdirs = [     9     os.path.join(os.path.split(__file__)[0], "lib"),    10     "/usr/share/micropython/lib"    11     ]    12     13 # Main program.    14     15 if __name__ == "__main__":    16     args = sys.argv[1:]    17     path = libdirs + sys.path[:]    18     path.append("tests")    19     20     # Process all tests.    21     22     try:    23         _f = args.index("-f")    24         filenames = args[_f+1:]    25         args = args[:_f]    26     except ValueError:    27         filenames = glob(os.path.join("tests", "*.py"))    28     29     filenames.sort()    30     31     # Make some arguments for the test program.    32     33     args.append("-t")    34     if "-tb" not in args:    35         args.append("-exit")    36     37     results = []    38     39     for filename in filenames:    40         print "Processing", filename    41         success = 0 == os.system("%s test.py %s %s" % (sys.executable, filename, " ".join(args)))    42         print "Test successful?", success and "Yes" or "No"    43         results.append((filename, success))    44     45     failed = [result[0] for result in results if not result[1]]    46     if failed:    47         print    48         print "Failed tests:"    49         for filename in failed:    50             print filename    51     52     print    53     print "All successful?"    54     print reduce(operator.and_, [x[1] for x in results], 1) and "Yes" or "No"    55     56 # vim: tabstop=4 expandtab shiftwidth=4