| OLD | NEW |
| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 with in_directory(repo['root']): | 200 with in_directory(repo['root']): |
| 201 args = [ | 201 args = [ |
| 202 sys.executable, self._recipe_tool, | 202 sys.executable, self._recipe_tool, |
| 203 '--package', os.path.join( | 203 '--package', os.path.join( |
| 204 repo['root'], 'infra', 'config', 'recipes.cfg'), | 204 repo['root'], 'infra', 'config', 'recipes.cfg'), |
| 205 ] | 205 ] |
| 206 for repo, path in overrides: | 206 for repo, path in overrides: |
| 207 args.extend(['-O', '%s=%s' % (repo, path)]) | 207 args.extend(['-O', '%s=%s' % (repo, path)]) |
| 208 args.extend([ | 208 args.extend([ |
| 209 '--use-bootstrap', | 209 '--use-bootstrap', |
| 210 'test', 'run', '--train', | 210 'test', 'train', |
| 211 ]) | 211 ]) |
| 212 subprocess.check_output(args, stderr=subprocess.STDOUT) | 212 subprocess.check_output(args, stderr=subprocess.STDOUT) |
| 213 | 213 |
| 214 def update_recipe(self, repo, name, deps, calls): | 214 def update_recipe(self, repo, name, deps, calls): |
| 215 """Updates or creates a recipe in given repo. | 215 """Updates or creates a recipe in given repo. |
| 216 Commits the change. | 216 Commits the change. |
| 217 | 217 |
| 218 Arguments: | 218 Arguments: |
| 219 repo(dict): one of the repos returned by |repo_setup| | 219 repo(dict): one of the repos returned by |repo_setup| |
| 220 name(str): name of the recipe (without .py) | 220 name(str): name of the recipe (without .py) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 message = ' '.join( | 315 message = ' '.join( |
| 316 ['update %r recipe_module: ' % name] + | 316 ['update %r recipe_module: ' % name] + |
| 317 ['%s(%s)' % t for t in methods.iteritems()] | 317 ['%s(%s)' % t for t in methods.iteritems()] |
| 318 ) | 318 ) |
| 319 return self.commit_in_repo(repo, message) | 319 return self.commit_in_repo(repo, message) |
| 320 | 320 |
| 321 def reset_repo(self, repo, revision): | 321 def reset_repo(self, repo, revision): |
| 322 """Resets repo contents to given revision.""" | 322 """Resets repo contents to given revision.""" |
| 323 with in_directory(repo['root']): | 323 with in_directory(repo['root']): |
| 324 subprocess.check_output(['git', 'reset', '--hard', revision]) | 324 subprocess.check_output(['git', 'reset', '--hard', revision]) |
| OLD | NEW |