Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: tests/super_mox.py

Issue 7906009: Fix a typo that resulted in no tests to be run in depot_tools. :( (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: More Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/scm_unittest.py ('k') | tests/trychange_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 # found in the LICENSE file.
4 4
5 """Simplify unit tests based on pymox.""" 5 """Simplify unit tests based on pymox."""
6 6
7 import os 7 import os
8 import random 8 import random
9 import shutil 9 import shutil
10 import string 10 import string
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 TestCaseUtils.tearDown(self) 134 TestCaseUtils.tearDown(self)
135 mox.MoxTestBase.tearDown(self) 135 mox.MoxTestBase.tearDown(self)
136 136
137 def MockList(self, parent, items_to_mock): 137 def MockList(self, parent, items_to_mock):
138 for item in items_to_mock: 138 for item in items_to_mock:
139 # Skip over items not present because of OS-specific implementation, 139 # Skip over items not present because of OS-specific implementation,
140 # implemented only in later python version, etc. 140 # implemented only in later python version, etc.
141 if hasattr(parent, item): 141 if hasattr(parent, item):
142 try: 142 try:
143 self.mox.StubOutWithMock(parent, item) 143 self.mox.StubOutWithMock(parent, item)
144 except TypeError: 144 except TypeError, e:
145 raise TypeError('Couldn\'t mock %s in %s' % (item, parent.__name__)) 145 raise TypeError(
146 'Couldn\'t mock %s in %s: %s' % (item, parent.__name__, e))
146 147
147 def UnMock(self, obj, name): 148 def UnMock(self, obj, name):
148 """Restore an object inside a test.""" 149 """Restore an object inside a test."""
149 for (parent, old_child, child_name) in self.mox.stubs.cache: 150 for (parent, old_child, child_name) in self.mox.stubs.cache:
150 if parent == obj and child_name == name: 151 if parent == obj and child_name == name:
151 setattr(parent, child_name, old_child) 152 setattr(parent, child_name, old_child)
152 break 153 break
OLDNEW
« no previous file with comments | « tests/scm_unittest.py ('k') | tests/trychange_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698