Bug 458256. Use LoadLibraryW instead of LoadLibrary (patch by DougT). r+sr=vlad
[wine-gecko.git] / tools / httptester / results.py
blob954166374b6d2b7635310dcb82e8a98d82fa72bd
1 """Store the results.
3 Use a db, but we could do better"""
5 import shelve
6 import string
8 class results:
9 def __init__(self, id):
10 self.id = id
11 self.d = shelve.open("data/"+id+".db")
13 def get_tester(self, path):
14 import BaseTest
16 try:
17 fname = path+"tester.py"
18 text = open(fname).read()
19 # Thanks to markh, for showing me how to do this
20 # Python Is Cool.
21 codeob = compile(text, fname, "exec")
22 namespace = { 'BaseTester': BaseTest.tester }
23 exec codeob in namespace, namespace
24 tester = namespace['tester']()
25 except IOError:
26 tester = BaseTest.tester()
28 if self.d.has_key(path):
29 tester.__dict__ = self.d[path]
30 else:
31 tester.parse_config(open(path+"config"))
33 return tester
35 def set_tester(self, path, test):
36 self.d[path] = test.__dict__
38 def write_report(self, file):
39 for i in self.d.keys():
40 file.write("%s: " % (i))
41 tester = self.get_tester(i)
42 res, detail = tester.result()
43 if res:
44 file.write("Pass!\n")
45 else:
46 file.write("Fail: %s\n" % (detail))
48 def __del__(self):
49 self.d.close()