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

Unified Diff: appengine/findit/crash/crash_pipeline.py

Issue 2605943002: Removing the mutation in the factories for getting dep repositories (Closed)
Patch Set: Created 4 years 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/crash/crash_pipeline.py
diff --git a/appengine/findit/crash/crash_pipeline.py b/appengine/findit/crash/crash_pipeline.py
index a554223750dbaccbf9785296790a69eae49b4b2e..e12eaca7fb75c353caf86740368a9b1a1895e853 100644
--- a/appengine/findit/crash/crash_pipeline.py
+++ b/appengine/findit/crash/crash_pipeline.py
@@ -22,7 +22,7 @@ from model import analysis_status
# TODO(http://crbug.com/659346): write complete coverage tests for this.
-def FinditForClientID(client_id, repository): # pragma: no cover
+def FinditForClientID(client_id, get_repository): # pragma: no cover
"""Construct a Findit object from a client id string specifying the class.
We cannot pass Findit objects to the various methods in
@@ -52,7 +52,7 @@ def FinditForClientID(client_id, repository): # pragma: no cover
raise ValueError('FinditForClientID: '
'unknown or unsupported client %s' % client_id)
- return cls(repository)
+ return cls(get_repository)
# Some notes about the classes below, for people who are not familiar
@@ -87,14 +87,16 @@ def FinditForClientID(client_id, repository): # pragma: no cover
# twice. This also means ``run`` can't store anything in the pipeline
# object and expect it to still be available in the ``finalized`` method.
+def _CachedGitilesRepositoryFactory(repo_url): # pragma: no cover
Sharu Jiang 2016/12/28 23:05:12 what's the reason for ``pragma: no cover`` here?
wrengr 2016/12/29 20:57:31 Apparently it's never called by the unit tests ¯\_
+ return cached_gitiles_repository.CachedGitilesRepository(
+ HttpClientAppengine(), repo_url)
+
+
class CrashBasePipeline(BasePipeline):
def __init__(self, client_id, crash_identifiers):
super(CrashBasePipeline, self).__init__(client_id, crash_identifiers)
self._crash_identifiers = crash_identifiers
- self._findit = FinditForClientID(
- client_id,
- cached_gitiles_repository.CachedGitilesRepository(
- HttpClientAppengine()))
+ self._findit = FinditForClientID(client_id, _CachedGitilesRepositoryFactory)
@property
def client_id(self): # pragma: no cover

Powered by Google App Engine
This is Rietveld 408576698