def __init__(self, *a, **k): self._logs_positions = {} cwd = os.getcwd() self._abspath_logs = [ os.path.join(cwd, ll) for ll in self._logs_to_show ] TestResultDecorator.__init__(self, *a, **k)
def startTest(self, test): """Record the logs positions when the test starts.""" for log in self._abspath_logs: if os.path.exists(log): self._logs_positions[log] = os.stat(log).st_size else: self._logs_positions[log] = 0 TestResultDecorator.startTest(self, test)
def addError(self, test, error): """Show the log and forward the error.""" self._show_the_logs() TestResultDecorator.addError(self, test, error)
def addFailure(self, test, fail): """Show the log and forward the failure.""" self._show_the_logs() TestResultDecorator.addFailure(self, test, fail)
def __init__(self, *a, **k): self._logs_positions = {} cwd = os.getcwd() self._abspath_logs = [os.path.join(cwd, l) for l in self._logs_to_show] TestResultDecorator.__init__(self, *a, **k)