validate: launcher: Initialize reporter timer before starting all tests

Patch 1/5 to move logfile handling out of Reporter and into Test.
This commit is contained in:
Ramiro Polla 2015-01-16 18:25:56 +01:00 committed by Thibault Saunier
parent bdedd7abb9
commit 39a4092434
2 changed files with 5 additions and 4 deletions

View file

@ -999,6 +999,7 @@ class _TestsLauncher(Loggable):
for tester in self.testers:
total_num_tests += len(tester.list_tests())
self.reporter.init_timer()
for tester in self.testers:
res = tester.run_tests(cur_test_num, total_num_tests)
cur_test_num += len(tester.list_tests())

View file

@ -66,8 +66,11 @@ class Reporter(Loggable):
}
self.results = []
def init_timer(self):
"""Initialize a timer before starting tests."""
self._start_time = time.time()
def before_test(self, test):
"""Initialize a timer before starting a test."""
path = os.path.join(self.options.logsdir,
test.classname.replace(".", os.sep))
mkdir(os.path.dirname(path))
@ -81,9 +84,6 @@ class Reporter(Loggable):
self.out = open(path, 'w+')
self._current_test = test
if self._start_time == 0:
self._start_time = time.time()
def set_failed(self, test):
self.stats["failure"] += 1