diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index 308a2d3..1b53963 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -748,10 +748,11 @@ def run_tests(self, cur_test_num, total_num_tests): i = cur_test_num for test in self.tests: sys.stdout.write("[%d / %d] " % (i + 1, total_num_tests)) - self.reporter.before_test(test) + self.reporter.open_logfile(test) res = test.run() i += 1 self.reporter.after_test(test) + self.reporter.close_logfile() if res != Result.PASSED and (self.options.forever or self.options.fatal_error): return test.result diff --git a/validate/launcher/reporters.py b/validate/launcher/reporters.py index ba4e4a2..842b852 100644 --- a/validate/launcher/reporters.py +++ b/validate/launcher/reporters.py @@ -69,7 +69,7 @@ def init_timer(self): """Initialize a timer before starting tests.""" self._start_time = time.time() - def before_test(self, test): + def open_logfile(self, test): path = os.path.join(self.options.logsdir, test.classname.replace(".", os.sep)) mkdir(os.path.dirname(path)) @@ -103,6 +103,8 @@ def after_test(self, test): self.results.append(test) self.add_results(test) + + def close_logfile(self): if not self.options.redirect_logs: self.out.close()