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

Side by Side Diff: unittests/repo_test_util.py

Issue 2779683005: [package.proto] convert deps from list to map. (Closed)
Patch Set: fixit Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « unittests/package_test.py ('k') | unittests/test_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The LUCI Authors. All rights reserved. 1 # Copyright 2016 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Utilities for testing with real repos (e.g. git).""" 5 """Utilities for testing with real repos (e.g. git)."""
6 6
7 7
8 import contextlib 8 import contextlib
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 def repo_setup(self, repo_deps): 113 def repo_setup(self, repo_deps):
114 """Creates a set of repos with recipes.cfg reflecting requested 114 """Creates a set of repos with recipes.cfg reflecting requested
115 dependencies. 115 dependencies.
116 116
117 In order to avoid a topsort, we require that repo names are in 117 In order to avoid a topsort, we require that repo names are in
118 alphebetical dependency order -- i.e. later names depend on earlier 118 alphebetical dependency order -- i.e. later names depend on earlier
119 ones. 119 ones.
120 """ 120 """
121 repos = {} 121 repos = {}
122 for k in sorted(repo_deps): 122 for k in sorted(repo_deps):
123 deps=[package_pb2.DepSpec( 123 deps = {
124 project_id='recipe_engine', 124 'recipe_engine': package_pb2.DepSpec(url="file://"+ROOT_DIR),
125 url="file://"+ROOT_DIR, 125 }
126 )] + [ 126 for d in repo_deps[k]:
127 package_pb2.DepSpec( 127 deps[d] = package_pb2.DepSpec(
128 project_id=d,
129 url=repos[d]['root'], 128 url=repos[d]['root'],
130 branch='master', 129 branch='master',
131 revision=repos[d]['revision'], 130 revision=repos[d]['revision'],
132 ) 131 )
133 for d in repo_deps[k]
134 ]
135 132
136 repos[k] = self.create_repo(k, package_pb2.Package( 133 repos[k] = self.create_repo(k, package_pb2.Package(
137 api_version=1, 134 api_version=1,
138 project_id=k, 135 project_id=k,
139 recipes_path='', 136 recipes_path='',
140 deps=deps, 137 deps=deps,
141 )) 138 ))
142 return repos 139 return repos
143 140
144 def updated_package_spec_pb(self, repo, dep_name, dep_revision): 141 def updated_package_spec_pb(self, repo, dep_name, dep_revision):
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 message = ' '.join( 315 message = ' '.join(
319 ['update %r recipe_module: ' % name] + 316 ['update %r recipe_module: ' % name] +
320 ['%s(%s)' % t for t in methods.iteritems()] 317 ['%s(%s)' % t for t in methods.iteritems()]
321 ) 318 )
322 return self.commit_in_repo(repo, message) 319 return self.commit_in_repo(repo, message)
323 320
324 def reset_repo(self, repo, revision): 321 def reset_repo(self, repo, revision):
325 """Resets repo contents to given revision.""" 322 """Resets repo contents to given revision."""
326 with in_directory(repo['root']): 323 with in_directory(repo['root']):
327 subprocess.check_output(['git', 'reset', '--hard', revision]) 324 subprocess.check_output(['git', 'reset', '--hard', revision])
OLDNEW
« no previous file with comments | « unittests/package_test.py ('k') | unittests/test_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698