Mercurial > pydertron
comparison test_pydertron.py @ 15:f30bd92e2216
Added support for running test suite over http.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 10 Sep 2009 14:36:17 -0700 |
parents | 16fe9c63aedb |
children | 9426f9fa6dc0 |
comparison
equal
deleted
inserted
replaced
14:16fe9c63aedb | 15:f30bd92e2216 |
---|---|
28 return stats | 28 return stats |
29 | 29 |
30 if __name__ == '__main__': | 30 if __name__ == '__main__': |
31 base_libpath = os.path.join("interoperablejs-read-only", | 31 base_libpath = os.path.join("interoperablejs-read-only", |
32 "compliance") | 32 "compliance") |
33 if not os.path.exists(base_libpath): | 33 |
34 if len(sys.argv) == 2 and sys.argv[1] == '--with-http': | |
35 with_http = True | |
36 else: | |
37 with_http = False | |
38 | |
39 if not os.path.exists(base_libpath) and not with_http: | |
34 print "Please run the following command and then re-run " | 40 print "Please run the following command and then re-run " |
35 print "this script:" | 41 print "this script:" |
36 print | 42 print |
37 print ("svn checkout " | 43 print ("svn checkout " |
38 "http://interoperablejs.googlecode.com/svn/trunk/ " | 44 "http://interoperablejs.googlecode.com/svn/trunk/ " |
39 "interoperablejs-read-only") | 45 "interoperablejs-read-only") |
46 print | |
47 print "Alternatively, run this script with the '--with-http' " | |
48 print "option to run the tests over http." | |
40 sys.exit(1) | 49 sys.exit(1) |
41 | 50 |
42 dirs = [(os.path.join(base_libpath, name), name) | 51 BASE_URL = "http://interoperablejs.googlecode.com/svn/trunk/compliance/" |
43 for name in os.listdir(base_libpath) | 52 |
44 if name not in ['.svn', 'ORACLE']] | 53 if with_http: |
54 names = ['absolute', 'cyclic', 'determinism', 'exactExports', | |
55 'hasOwnProperty', 'method', 'missing', 'monkeys', | |
56 'nested', 'reflexive', 'relative', 'transitive'] | |
57 dirs = [("%s%s/"% (BASE_URL, name), name) | |
58 for name in names] | |
59 fsfactory = HttpFileSystem | |
60 else: | |
61 dirs = [(os.path.join(base_libpath, name), name) | |
62 for name in os.listdir(base_libpath) | |
63 if name not in ['.svn', 'ORACLE']] | |
64 fsfactory = SandboxedFileSystem | |
45 | 65 |
46 totals = {'pass': 0, 'fail': 0} | 66 totals = {'pass': 0, 'fail': 0} |
47 | 67 |
48 BASE_URL = "http://interoperablejs.googlecode.com/svn/trunk/compliance/" | |
49 | |
50 for libpath, name in dirs: | 68 for libpath, name in dirs: |
51 #fs = HttpFileSystem("%s%s/"% (BASE_URL, name)) | 69 fs = fsfactory(libpath) |
52 fs = SandboxedFileSystem(libpath) | |
53 stats = run_test(name, fs) | 70 stats = run_test(name, fs) |
54 totals['pass'] += stats['pass'] | 71 totals['pass'] += stats['pass'] |
55 totals['fail'] += stats['fail'] | 72 totals['fail'] += stats['fail'] |
56 | 73 |
57 print "passed: %(pass)d failed: %(fail)d" % totals | 74 print "passed: %(pass)d failed: %(fail)d" % totals |