3 Use a db, but we could do better"""
9 def __init__(self
, id):
11 self
.d
= shelve
.open("data/"+id+".db")
13 def get_tester(self
, path
):
17 fname
= path
+"tester.py"
18 text
= open(fname
).read()
19 # Thanks to markh, for showing me how to do this
21 codeob
= compile(text
, fname
, "exec")
22 namespace
= { 'BaseTester': BaseTest
.tester
}
23 exec codeob
in namespace
, namespace
24 tester
= namespace
['tester']()
26 tester
= BaseTest
.tester()
28 if self
.d
.has_key(path
):
29 tester
.__dict
__ = self
.d
[path
]
31 tester
.parse_config(open(path
+"config"))
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()
46 file.write("Fail: %s\n" % (detail
))