| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import unittest |
| 6 |
| 7 |
| 8 class AutofillTestResult(unittest.TextTestResult): |
| 9 """A test result class that can print formatted text results to a stream. |
| 10 |
| 11 Used by AutofillTestRunner. |
| 12 """ |
| 13 |
| 14 def startTest(self, test): |
| 15 """Called when a test is started. |
| 16 """ |
| 17 super(unittest.TextTestResult, self).startTest(test) |
| 18 if self.showAll: |
| 19 self.stream.write('Running ') |
| 20 self.stream.write(self.getDescription(test)) |
| 21 self.stream.write('\n') |
| 22 self.stream.flush() |
| 23 |
| 24 def addFailure(self, test, err): |
| 25 """Logs a test failure as part of the specified test. |
| 26 |
| 27 Overloaded to not include the stack trace. |
| 28 |
| 29 Args: |
| 30 err: A tuple of values as returned by sys.exc_info(). |
| 31 """ |
| 32 err = (None, err[1], None) |
| 33 # self.failures.append((test, str(exception))) |
| 34 # self._mirrorOutput = True |
| 35 super(AutofillTestResult, self).addFailure(test, err) |
| 36 |
| 37 |
| 38 class AutofillTestRunner(unittest.TextTestRunner): |
| 39 """An autofill test runner class that displays results in textual form. |
| 40 |
| 41 It prints out the names of tests as they are run, errors as they |
| 42 occur, and a summary of the results at the end of the test run. |
| 43 """ |
| 44 resultclass = AutofillTestResult |
| OLD | NEW |