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

Unified Diff: build/android/pylib/utils/mock_calls.py

Issue 929603002: [Android] Add PIE support for ICS devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« build/android/pylib/utils/md5sum.py ('K') | « build/android/pylib/utils/md5sum.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« build/android/pylib/utils/md5sum.py ('K') | « build/android/pylib/utils/md5sum.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698