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

Side by Side Diff: tests/super_mox.py

Issue 6690034: Add more python 2.5 compatibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Don't force python 2.5 anymore (to be done in a separate change) Created 9 years, 8 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
OLDNEW
1 #!/usr/bin/python 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # 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
4 # found in the LICENSE file. 3 # found in the LICENSE file.
5 4
6 """Simplify unit tests based on pymox.""" 5 """Simplify unit tests based on pymox."""
7 6
8 import os 7 import os
9 import random 8 import random
10 import shutil 9 import shutil
11 import string 10 import string
12 import StringIO 11 import StringIO
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 self.mox.StubOutWithMock(parent, item) 143 self.mox.StubOutWithMock(parent, item)
145 except TypeError: 144 except TypeError:
146 raise TypeError('Couldn\'t mock %s in %s' % (item, parent.__name__)) 145 raise TypeError('Couldn\'t mock %s in %s' % (item, parent.__name__))
147 146
148 def UnMock(self, obj, name): 147 def UnMock(self, obj, name):
149 """Restore an object inside a test.""" 148 """Restore an object inside a test."""
150 for (parent, old_child, child_name) in self.mox.stubs.cache: 149 for (parent, old_child, child_name) in self.mox.stubs.cache:
151 if parent == obj and child_name == name: 150 if parent == obj and child_name == name:
152 setattr(parent, child_name, old_child) 151 setattr(parent, child_name, old_child)
153 break 152 break
OLDNEW
« tests/owners_unittest.py ('K') | « tests/scm_unittest.py ('k') | tests/trial_dir.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698