Revision 74db37c0 test/py/testutils.py
b/test/py/testutils.py | ||
---|---|---|
209 | 209 |
return fname |
210 | 210 |
|
211 | 211 |
|
212 |
def patch_object(*args, **kwargs): |
|
213 |
"""Unified patch_object for various versions of Python Mock. |
|
214 |
|
|
215 |
Different Python Mock versions provide incompatible versions of patching an |
|
216 |
object. More recent versions use _patch_object, older ones used patch_object. |
|
217 |
This function unifies the different variations. |
|
218 |
|
|
219 |
""" |
|
220 |
import mock |
|
221 |
try: |
|
222 |
return mock._patch_object(*args, **kwargs) |
|
223 |
except AttributeError: |
|
224 |
return mock.patch_object(*args, **kwargs) |
|
225 |
|
|
226 |
|
|
212 | 227 |
def UnifyValueType(data): |
213 | 228 |
"""Converts all tuples into lists. |
214 | 229 |
|
Also available in: Unified diff