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

Unified Diff: appengine/findit/crash/test/changelist_classifier_test.py

Issue 2608483002: Changed FindSuspects to take a Repository factory, rather than mutating it (Closed)
Patch Set: rebase Created 3 years, 12 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 | « appengine/findit/crash/loglinear/test/changelist_classifier_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/crash/test/changelist_classifier_test.py
diff --git a/appengine/findit/crash/test/changelist_classifier_test.py b/appengine/findit/crash/test/changelist_classifier_test.py
index 40563747e72913025b506dacb30665330a721ee0..e1ca7374e9f7325699f9dd2388925bd063372a0a 100644
--- a/appengine/findit/crash/test/changelist_classifier_test.py
+++ b/appengine/findit/crash/test/changelist_classifier_test.py
@@ -123,8 +123,23 @@ class ChangelistClassifierTest(CrashTestSuite):
def setUp(self):
super(ChangelistClassifierTest, self).setUp()
+
+ repository = GitilesRepository(self.GetMockHttpClient())
+
+ # TODO(crbug.com/677224): should replace this with an actual factory.
+ def MutateTheRepo(dep_url): # pragma: no cover
+ """A factory function for returning ``Repository`` objects.
+
+ The current definition captures the functionality of before
+ we factored out this factory method. That is, it's not really a
+ "factory" but rather mutates the main repo object in place. In
+ the future this should be changed to do the right thing instead.
+ """
+ repository.repo_url = dep_url
+ return repository
+
self.changelist_classifier = changelist_classifier.ChangelistClassifier(
- GitilesRepository(self.GetMockHttpClient()), 7)
+ repository, MutateTheRepo, 7)
def testSkipAddedAndDeletedRegressionRolls(self):
self.mock(chrome_dependency_fetcher.ChromeDependencyFetcher,
@@ -313,7 +328,7 @@ class ChangelistClassifierTest(CrashTestSuite):
suspects = changelist_classifier.FindSuspects(
dep_file_to_changelogs, dep_file_to_stack_infos, stack_deps,
- GitilesRepository(self.GetMockHttpClient()))
+ lambda repo_url: GitilesRepository(self.GetMockHttpClient(), repo_url))
self.assertListEqual([suspect.ToDict() for suspect in suspects],
expected_suspects)
« no previous file with comments | « appengine/findit/crash/loglinear/test/changelist_classifier_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698