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

Side by Side Diff: unittests/repo_test_util.py

Issue 2669033007: [recipe_engine] Fix a couple path-related bugs. (Closed)
Patch Set: Fix remainder of presubmit tests Created 3 years, 10 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
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 def repo_setup(self, repo_deps): 106 def repo_setup(self, repo_deps):
107 """Creates a set of repos with recipes.cfg reflecting requested 107 """Creates a set of repos with recipes.cfg reflecting requested
108 dependencies. 108 dependencies.
109 109
110 In order to avoid a topsort, we require that repo names are in 110 In order to avoid a topsort, we require that repo names are in
111 alphebetical dependency order -- i.e. later names depend on earlier 111 alphebetical dependency order -- i.e. later names depend on earlier
112 ones. 112 ones.
113 """ 113 """
114 repos = {} 114 repos = {}
115 for k in sorted(repo_deps): 115 for k in sorted(repo_deps):
116 deps=[package_pb2.DepSpec(
117 project_id='recipe_engine',
118 url="file://"+ROOT_DIR,
119 )] + [
120 package_pb2.DepSpec(
121 project_id=d,
122 url=repos[d]['root'],
123 branch='master',
124 revision=repos[d]['revision'],
125 )
126 for d in repo_deps[k]
127 ]
128
116 repos[k] = self.create_repo(k, package_pb2.Package( 129 repos[k] = self.create_repo(k, package_pb2.Package(
117 api_version=1, 130 api_version=1,
118 project_id=k, 131 project_id=k,
119 recipes_path='', 132 recipes_path='',
120 deps=[ 133 deps=deps,
121 package_pb2.DepSpec(
122 project_id=d,
123 url=repos[d]['root'],
124 branch='master',
125 revision=repos[d]['revision'],
126 )
127 for d in repo_deps[k]
128 ],
129 )) 134 ))
130 return repos 135 return repos
131 136
132 def updated_package_spec_pb(self, repo, dep_name, dep_revision): 137 def updated_package_spec_pb(self, repo, dep_name, dep_revision):
133 """Returns package spec for given repo, with specified revision 138 """Returns package spec for given repo, with specified revision
134 for given dependency. 139 for given dependency.
135 """ 140 """
136 spec = self.get_package_spec(repo) 141 spec = self.get_package_spec(repo)
137 spec.deps[dep_name].revision = dep_revision 142 spec.deps[dep_name].revision = dep_revision
138 return spec.dump() 143 return spec.dump()
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 message = ' '.join( 293 message = ' '.join(
289 ['update %r recipe_module: ' % name] + 294 ['update %r recipe_module: ' % name] +
290 ['%s(%s)' % t for t in methods.iteritems()] 295 ['%s(%s)' % t for t in methods.iteritems()]
291 ) 296 )
292 return self.commit_in_repo(repo, message) 297 return self.commit_in_repo(repo, message)
293 298
294 def reset_repo(self, repo, revision): 299 def reset_repo(self, repo, revision):
295 """Resets repo contents to given revision.""" 300 """Resets repo contents to given revision."""
296 with in_directory(repo['root']): 301 with in_directory(repo['root']):
297 subprocess.check_output(['git', 'reset', '--hard', revision]) 302 subprocess.check_output(['git', 'reset', '--hard', revision])
OLDNEW
« recipe_engine/package.py ('K') | « recipes/engine_tests/recipe_paths.expected/basic.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698