Chromium Code Reviews| Index: appengine/findit/common/chromium_deps.py |
| diff --git a/appengine/findit/common/chromium_deps.py b/appengine/findit/common/chromium_deps.py |
| index 39c63472fa5e4b9e3d052d27103ea0f746e9eb9d..5dbd21a1f1e2caa221df74d1c93cbfaeb1fde320 100644 |
| --- a/appengine/findit/common/chromium_deps.py |
| +++ b/appengine/findit/common/chromium_deps.py |
| @@ -4,9 +4,17 @@ |
| import re |
| +# N.B., in order for our mocking framework to work correctly, we *must not* |
| +# import the GitRepository class directly; instead, we must only import |
| +# the git_repository module and then rely on dynamic dispatch to resolve |
| +# the module's GitRepository attribute. Otherwise the DEPSDownloader.Load |
| +# method will hold a reference directly to the real GitRepository class, |
| +# which means we can't swap it out for the DummyGitRepository class, which |
| +# in turn will cause some unit tests to fail (since we can't mock the |
| +# responses of doing SSL stuff). |
|
stgao
2016/09/21 23:03:24
BTW, can we remove this comment? For functional co
stgao
2016/09/21 23:03:24
This sgtm in general. But it is possible to mock a
wrengr
2016/09/28 00:59:49
I appreciate the desire to remove the comment, but
stgao
2016/10/13 05:47:31
Then let's keep it. Thanks for your time figuring
|
| +from gitiles import git_repository |
|
stgao
2016/09/21 23:03:24
nit: import order.
|
| from common import dependency |
| from common import deps_parser |
| -from common import git_repository |
| from common import http_client_appengine |
| @@ -30,6 +38,9 @@ def IsChromeVersion(revision): |
| class DEPSDownloader(deps_parser.DEPSLoader): |
| """Downloads DEPS from remote Git repo.""" |
| + # TODO(wrengr): why do we allocate a new GitRepository every time |
| + # we call Load, rather than just doing it once and saving it in the |
| + # DEPSDownloader class (via RAII)? |
|
stgao
2016/09/21 23:03:24
Because a GitRepository is defined by the repo_url
wrengr
2016/09/28 00:59:49
We could just as well (a) pass repo_url to the DEP
|
| def Load(self, repo_url, revision, deps_file): |
| http_client = http_client_appengine.HttpClientAppengine() |
| repo = git_repository.GitRepository(repo_url, http_client) |