OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 __version__ = '1.0' | 5 __version__ = '1.0' |
6 | 6 |
7 import collections | 7 import collections |
8 import inspect | 8 import inspect |
9 import unittest | 9 import unittest |
10 | 10 |
11 | 11 |
12 class AutoStubMixIn(object): | 12 class AutoStubMixIn(object): |
13 """Automatically restores stubbed functions on unit test teardDown. | 13 """Automatically restores stubbed functions on unit test teardDown. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 class TestCase(unittest.TestCase, AutoStubMixIn): | 65 class TestCase(unittest.TestCase, AutoStubMixIn): |
66 """Adds self.mock() and self.has_failed() to a TestCase.""" | 66 """Adds self.mock() and self.has_failed() to a TestCase.""" |
67 def tearDown(self): | 67 def tearDown(self): |
68 AutoStubMixIn.tearDown(self) | 68 AutoStubMixIn.tearDown(self) |
69 unittest.TestCase.tearDown(self) | 69 unittest.TestCase.tearDown(self) |
70 | 70 |
71 def has_failed(self): | 71 def has_failed(self): |
72 """Returns True if the test has failed.""" | 72 """Returns True if the test has failed.""" |
73 return not self._resultForDoCleanups.wasSuccessful() | 73 return not self._resultForDoCleanups.wasSuccessful() |
OLD | NEW |