pactest: delay test object creation

The actual test object is only used to run the test.  Storing test cases
as strings limits the test object scope and allows it to be garbage
collected, reducing memory usage when multiple tests are run.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2014-08-01 14:19:46 -07:00 committed by Allan McRae
parent 85c80542a5
commit 22e478d203
1 changed files with 3 additions and 3 deletions

View File

@ -51,14 +51,14 @@ def addtest(self, testcase):
"""
if not os.path.isfile(testcase):
raise IOError("test file %s not found" % testcase)
test = pmtest.pmtest(testcase, self.root)
self.testcases.append(test)
self.testcases.append(testcase)
def run(self):
"""
"""
tap.plan(len(self.testcases))
for t in self.testcases:
for testcase in self.testcases:
t = pmtest.pmtest(testcase, self.root)
tap.diag("Running '%s'" % t.testname)
t.load()