comparison test_pydertron.py @ 14:16fe9c63aedb

Added HttpFileSystem
author Atul Varma <varmaa@toolness.com>
date Thu, 10 Sep 2009 14:27:28 -0700
parents 6c55f09ff31d
children f30bd92e2216
comparison
equal deleted inserted replaced
13:6c55f09ff31d 14:16fe9c63aedb
1 import os 1 import os
2 import sys 2 import sys
3 3
4 import pydermonkey 4 import pydermonkey
5 from pydertron import JsSandbox, SandboxedFileSystem, jsexposed 5 from pydertron import JsSandbox, jsexposed
6 from pydertron import SandboxedFileSystem, HttpFileSystem
6 7
7 def run_test(name, libpath): 8 def run_test(name, fs):
8 sandbox = JsSandbox(SandboxedFileSystem(libpath)) 9 sandbox = JsSandbox(fs)
9
10 stats = {'pass': 0, 'fail': 0, 'info': 0} 10 stats = {'pass': 0, 'fail': 0, 'info': 0}
11 11
12 @jsexposed(name='print') 12 @jsexposed(name='print')
13 def jsprint(message, label): 13 def jsprint(message, label):
14 stats[label] += 1 14 stats[label] += 1
43 for name in os.listdir(base_libpath) 43 for name in os.listdir(base_libpath)
44 if name not in ['.svn', 'ORACLE']] 44 if name not in ['.svn', 'ORACLE']]
45 45
46 totals = {'pass': 0, 'fail': 0} 46 totals = {'pass': 0, 'fail': 0}
47 47
48 BASE_URL = "http://interoperablejs.googlecode.com/svn/trunk/compliance/"
49
48 for libpath, name in dirs: 50 for libpath, name in dirs:
49 stats = run_test(name, libpath) 51 #fs = HttpFileSystem("%s%s/"% (BASE_URL, name))
52 fs = SandboxedFileSystem(libpath)
53 stats = run_test(name, fs)
50 totals['pass'] += stats['pass'] 54 totals['pass'] += stats['pass']
51 totals['fail'] += stats['fail'] 55 totals['fail'] += stats['fail']
52 56
53 print "passed: %(pass)d failed: %(fail)d" % totals 57 print "passed: %(pass)d failed: %(fail)d" % totals
54 58