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

Unified Diff: appengine/findit/common/test/repo_util_test.py

Issue 2456603003: [Predator] Add local cache for get command output. (Closed)
Patch Set: . Created 4 years, 2 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
Index: appengine/findit/common/test/repo_util_test.py
diff --git a/appengine/findit/common/test/repo_util_test.py b/appengine/findit/common/test/repo_util_test.py
index 48c1e22d2db96aaf16ff15749d5640166be7bf4f..146ead662794e295ef6c2b00be49fd7c8b794701 100644
--- a/appengine/findit/common/test/repo_util_test.py
+++ b/appengine/findit/common/test/repo_util_test.py
@@ -10,6 +10,7 @@ import textwrap
import urllib2
from common import repo_util
+from common.cache_decorator import LocalCacher
class RepoUtilTest(testing.AppengineTestCase):
@@ -141,7 +142,7 @@ class RepoUtilTest(testing.AppengineTestCase):
self.command = command
def communicate(self, *_):
- return self.command, 'dummy'
+ return self.command, 'error'
@property
def returncode(self):
@@ -152,8 +153,12 @@ class RepoUtilTest(testing.AppengineTestCase):
def _MockPopen(command, **_):
return _MockProcess(command)
-
self.mock(subprocess, 'Popen', _MockPopen)
+
+ def _MockLocalCacherGet(*_):
+ return None
+ self.mock(LocalCacher, 'Get', _MockLocalCacherGet)
wrengr 2016/10/27 16:36:47 Why not just use a lambda. It's shorter and cleane
Sharu Jiang 2016/10/27 21:59:05 Done.
+
output = repo_util.GetCommandOutput('command')
self.assertEqual(output, 'command')

Powered by Google App Engine
This is Rietveld 408576698