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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.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
« no previous file with comments | « build/android/pylib/utils/md5sum.py ('k') | build/android/pylib/utils/mock_calls_test.py » ('j') | 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)
+ else:
+ return mock.patch.object(target, attribute, **kwargs)
else:
return mock.patch(call.name, **kwargs)
« no previous file with comments | « build/android/pylib/utils/md5sum.py ('k') | build/android/pylib/utils/mock_calls_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698