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

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: 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/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 c195088b7da34541896fdf073b9c3d2190e416af..9ac49dfb9d59463692bdb0f8717e9dfae33ad80c 100644
--- a/appengine/findit/crash/test/changelist_classifier_test.py
+++ b/appengine/findit/crash/test/changelist_classifier_test.py
@@ -118,12 +118,27 @@ DUMMY_REPORT = CrashReport(None, None, None, Stacktrace(DUMMY_CALLSTACKS,
DUMMY_CALLSTACKS[0]),
(None, None))
+
class ChangelistClassifierTest(CrashTestSuite):
def setUp(self):
super(ChangelistClassifierTest, self).setUp()
+
+ repository = GitilesRepository(self.GetMockHttpClient())
+
+ def MutateTheRepo(dep_url): # pragma: no cover
+ """A factory function for returning ``Repository`` objects.
+
+ The current definition captures the functionality of before
+ we actored 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,
@@ -312,7 +327,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)

Powered by Google App Engine
This is Rietveld 408576698