Chromium Code Reviews| Index: build/android/pylib/utils/mock_calls.py |
| diff --git a/build/android/pylib/utils/mock_calls.py b/build/android/pylib/utils/mock_calls.py |
| index fab9f2b4ecac41ad7bdd65b7eda87b02c0e32b0b..3052b0d34a4e6a33ee1506448c119d165c9033b3 100644 |
| --- a/build/android/pylib/utils/mock_calls.py |
| +++ b/build/android/pylib/utils/mock_calls.py |
| @@ -110,7 +110,12 @@ class TestCase(unittest.TestCase): |
| if call.name.startswith('self.'): |
| target = self.call_target(call.parent) |
| _, attribute = call.name.rsplit('.', 1) |
| - return mock.patch.object(target, attribute, **kwargs) |
| + if (hasattr(type(target), attribute) |
| + and isinstance(getattr(type(target), attribute), property)): |
| + return mock.patch.object( |
| + type(target), attribute, new_callable=mock.PropertyMock, **kwargs) |
|
perezju
2015/02/16 10:25:23
why do we need this for this CL? could we add a te
jbudorick
2015/02/17 15:15:10
see comment on device_utils_test.py, which uses it
|
| + else: |
| + return mock.patch.object(target, attribute, **kwargs) |
| else: |
| return mock.patch(call.name, **kwargs) |