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

Side by Side Diff: unittests/repo_test_util.py

Issue 2785503002: Revert of [package.proto] convert deps from list to map. (Closed)
Patch Set: 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 = { 123 deps=[package_pb2.DepSpec(
124 'recipe_engine': package_pb2.DepSpec(url="file://"+ROOT_DIR), 124 project_id='recipe_engine',
125 } 125 url="file://"+ROOT_DIR,
126 for d in repo_deps[k]: 126 )] + [
127 deps[d] = package_pb2.DepSpec( 127 package_pb2.DepSpec(
128 project_id=d,
128 url=repos[d]['root'], 129 url=repos[d]['root'],
129 branch='master', 130 branch='master',
130 revision=repos[d]['revision'], 131 revision=repos[d]['revision'],
131 ) 132 )
133 for d in repo_deps[k]
134 ]
132 135
133 repos[k] = self.create_repo(k, package_pb2.Package( 136 repos[k] = self.create_repo(k, package_pb2.Package(
134 api_version=1, 137 api_version=1,
135 project_id=k, 138 project_id=k,
136 recipes_path='', 139 recipes_path='',
137 deps=deps, 140 deps=deps,
138 )) 141 ))
139 return repos 142 return repos
140 143
141 def updated_package_spec_pb(self, repo, dep_name, dep_revision): 144 def updated_package_spec_pb(self, repo, dep_name, dep_revision):
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 message = ' '.join( 318 message = ' '.join(
316 ['update %r recipe_module: ' % name] + 319 ['update %r recipe_module: ' % name] +
317 ['%s(%s)' % t for t in methods.iteritems()] 320 ['%s(%s)' % t for t in methods.iteritems()]
318 ) 321 )
319 return self.commit_in_repo(repo, message) 322 return self.commit_in_repo(repo, message)
320 323
321 def reset_repo(self, repo, revision): 324 def reset_repo(self, repo, revision):
322 """Resets repo contents to given revision.""" 325 """Resets repo contents to given revision."""
323 with in_directory(repo['root']): 326 with in_directory(repo['root']):
324 subprocess.check_output(['git', 'reset', '--hard', revision]) 327 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