/[escript]/branches/diaplayground/tools/testrunner.py
ViewVC logotype

Contents of /branches/diaplayground/tools/testrunner.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5084 - (show annotations)
Sun Jun 29 23:29:51 2014 UTC (4 years, 9 months ago) by caltinay
File MIME type: text/x-python
File size: 1288 byte(s)
Fast forward to latest trunk which has had an impressive number of changes...

1 from __future__ import print_function
2 import sys
3
4 def rearrange(string):
5 parts = string.split()
6 parts = [parts[1][1:-1], parts[0]]
7 return ".".join(parts)
8
9 def run_tests(modules):
10 skiplist = []
11 for module in modules:
12 if module[-3:] == ".py":
13 module = module[:-3]
14 m = __import__(module)
15 res = m.run_tests(module)
16 if not res.wasSuccessful():
17 sys.exit(1)
18 skiplist.extend(["%s : %s"%(rearrange(str(i[0])),i[1]) for i in res.skipped])
19 return skiplist
20
21 if __name__ == "__main__":
22 modules = sys.argv[1:]
23 if len(modules) == 0:
24 print("%s missing argument, provide module to run tests on"%sys.argv[0])
25 sys.exit(1)
26 outputfile = None
27 appendfile = None
28 for n, m in enumerate(modules):
29 if m.startswith("-outputfile="):
30 modules.pop(n)
31 outputfile = m.split("=")[1]
32 break
33 if m.startswith("-appendfile="):
34 modules.pop(n)
35 appendfile = m.split("=")[1]
36 break
37 skipped = run_tests(modules)
38 if outputfile:
39 open(outputfile, "w").writelines("\n".join(skipped))
40 elif appendfile:
41 open(appendfile, "a").writelines("\n".join(skipped))
42 else:
43 print("\n".join(skipped))

  ViewVC Help
Powered by ViewVC 1.1.26