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

Side by Side Diff: unittests/repo_test_util.py

Issue 2934583003: [step] Remove config indirection. (Closed)
Patch Set: cleanup Created 3 years, 6 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 logging 9 import logging
10 import os 10 import os
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 with open(os.path.join(module_dir, 'api.py'), 'w') as f: 300 with open(os.path.join(module_dir, 'api.py'), 'w') as f:
301 f.write('\n'.join([ 301 f.write('\n'.join([
302 'from recipe_engine import recipe_api', 302 'from recipe_engine import recipe_api',
303 '', 303 '',
304 'class MyApi(recipe_api.RecipeApi):', 304 'class MyApi(recipe_api.RecipeApi):',
305 ' step_client = recipe_api.RequireClient(\'step\')', 305 ' step_client = recipe_api.RequireClient(\'step\')',
306 ] + [ 306 ] + [
307 '\n'.join([ 307 '\n'.join([
308 '', 308 '',
309 ' def %s(self):' % m_name, 309 ' def %s(self):' % m_name,
310 ' return self.step_client.run_step(%r)' % { 310 ' return self.step_client.run_step(**%r)' % {
311 'name': m_name, 311 'name': m_name,
312 'cmd': m_cmd, 312 'cmd': m_cmd,
313 'ok_ret': [0], 313 'ok_ret': [0],
314 'infra_step': False 314 'infra_step': False
315 }, 315 },
316 '', 316 '',
317 ]) for m_name, m_cmd in methods.iteritems() 317 ]) for m_name, m_cmd in methods.iteritems()
318 ])) 318 ]))
319 319
320 examples_dir = os.path.join(module_dir, 'examples') 320 examples_dir = os.path.join(module_dir, 'examples')
(...skipping 17 matching lines...) Expand all
338 shutil.rmtree(examples_dir) 338 shutil.rmtree(examples_dir)
339 339
340 self.train_recipes(repo) 340 self.train_recipes(repo)
341 341
342 subprocess.check_call(['git', 'add', module_dir]) 342 subprocess.check_call(['git', 'add', module_dir])
343 message = ' '.join( 343 message = ' '.join(
344 ['update %r recipe_module: ' % name] + 344 ['update %r recipe_module: ' % name] +
345 ['%s(%s)' % t for t in methods.iteritems()] 345 ['%s(%s)' % t for t in methods.iteritems()]
346 ) 346 )
347 return self.commit_in_repo(repo, message) 347 return self.commit_in_repo(repo, message)
OLDNEW
« recipe_modules/generator_script/api.py ('K') | « recipe_modules/step/config.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698