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

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

Issue 2605943002: Removing the mutation in the factories for getting dep repositories (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
Index: appengine/findit/crash/loglinear/test/changelist_classifier_test.py
diff --git a/appengine/findit/crash/loglinear/test/changelist_classifier_test.py b/appengine/findit/crash/loglinear/test/changelist_classifier_test.py
index c80db81d3890d503e9f3e3523e06b9caa705459e..0d5eb9a778ed6c5a1f3d877e43423e6d06faeb0a 100644
--- a/appengine/findit/crash/loglinear/test/changelist_classifier_test.py
+++ b/appengine/findit/crash/loglinear/test/changelist_classifier_test.py
@@ -10,7 +10,7 @@ from common.dependency import DependencyRoll
from common import chrome_dependency_fetcher
from crash import changelist_classifier
from crash.crash_report import CrashReport
-import crash.loglinear.changelist_classifier as loglinear_changelist_classifier
+from crash.loglinear.changelist_classifier import LogLinearChangelistClassifier
from crash.loglinear.feature import ChangedFile
from crash.loglinear.feature import FeatureValue
from crash.suspect import AnalysisInfo
@@ -117,23 +117,11 @@ class LogLinearChangelistClassifierTest(CrashTestSuite):
'TopFrameIndex': 1.,
}
- repository = GitilesRepository(self.GetMockHttpClient())
+ def MockGitilesRepositoryFactory(repo_url): # pragma: no cover
+ return GitilesRepository(self.GetMockHttpClient(), repo_url)
- # 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 = (
- loglinear_changelist_classifier.LogLinearChangelistClassifier(
- repository, MutateTheRepo, weights))
+ self.changelist_classifier = LogLinearChangelistClassifier(
+ MockGitilesRepositoryFactory, weights)
def testAggregateChangedFilesAggreegates(self):
"""Test that ``AggregateChangedFiles`` does aggregate reasons per file.
« no previous file with comments | « appengine/findit/crash/loglinear/changelist_classifier.py ('k') | appengine/findit/crash/test/changelist_classifier_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698