1.1 --- a/test.py Mon Mar 21 01:25:11 2011 +0100
1.2 +++ b/test.py Mon Mar 21 01:27:27 2011 +0100
1.3 @@ -95,5 +95,7 @@
1.4 print repr(exc)
1.5 if "-tb" in args:
1.6 raise
1.7 + elif "-exit" in args:
1.8 + sys.exit(1)
1.9
1.10 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/test_all.py Mon Mar 21 01:25:11 2011 +0100
2.2 +++ b/test_all.py Mon Mar 21 01:27:27 2011 +0100
2.3 @@ -1,7 +1,5 @@
2.4 #!/usr/bin/env python
2.5
2.6 -import micropython.cmd
2.7 -import rsvp
2.8 import sys
2.9 import os
2.10 from glob import glob
2.11 @@ -24,33 +22,25 @@
2.12 try:
2.13 _f = args.index("-f")
2.14 filenames = args[_f+1:]
2.15 + args = args[:_f]
2.16 except ValueError:
2.17 filenames = glob(os.path.join("tests", "*.py"))
2.18
2.19 filenames.sort()
2.20
2.21 + # Make some arguments for the test program.
2.22 +
2.23 + args.append("-t")
2.24 + if "-tb" not in args:
2.25 + args.append("-exit")
2.26 +
2.27 results = []
2.28
2.29 for filename in filenames:
2.30 print "Processing", filename
2.31 -
2.32 - try:
2.33 - p = micropython.cmd.get_program(path, args)
2.34 - m = p.get_importer().load_from_file(filename)
2.35 -
2.36 - # Report any errors.
2.37 -
2.38 - except micropython.ProcessingError, exc:
2.39 - print repr(exc)
2.40 - if "-tb" in args:
2.41 - raise
2.42 - results.append((filename, 0))
2.43 -
2.44 - else:
2.45 - rm = rsvp.machine(p)
2.46 - success = rm.test(m)
2.47 - print "Test successful?", success and "Yes" or "No"
2.48 - results.append((filename, success))
2.49 + success = 0 == os.system("%s test.py %s %s" % (sys.executable, filename, " ".join(args)))
2.50 + print "Test successful?", success and "Yes" or "No"
2.51 + results.append((filename, success))
2.52
2.53 failed = [result[0] for result in results if not result[1]]
2.54 if failed: