[pacman-dev] [PATCH 03/11] 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> --- This only affects calling pactest.py with multiple tests; `make check`, which runs each test in a separate instance, is unaffected. test/pacman/pmenv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/pacman/pmenv.py b/test/pacman/pmenv.py index fa864fe..2d887b0 100644 --- a/test/pacman/pmenv.py +++ b/test/pacman/pmenv.py @@ -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() -- 2.0.2
participants (1)
-
Andrew Gregory