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

Unified Diff: unittests/repo_test_util.py

Issue 2664223002: Add unit tests for overrides in multi-repo workflow (Closed)
Patch Set: reverts Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « unittests/override_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittests/repo_test_util.py
diff --git a/unittests/repo_test_util.py b/unittests/repo_test_util.py
index 2e7985361a6f91475748ccc696d71e105d7d935c..664ab0ba40a1f4e5a0524fe64b93454b296af5be 100644
--- a/unittests/repo_test_util.py
+++ b/unittests/repo_test_util.py
@@ -177,6 +177,31 @@ class RepoTest(unittest.TestCase):
'message': message,
}
+ def train_recipes(self, repo, overrides=None):
+ """Trains recipe simulation tests in given repo.
+
+ Arguments:
+ repo(dict): one of the repos returned by |repo_setup|
+ overrides: iterable((str, str)): optional list of overrides
+ first element of the tuple is the module name, and second
+ is the overriding path
+ """
+ if not overrides:
+ overrides = []
+ with in_directory(repo['root']):
+ args = [
+ sys.executable, self._recipe_tool,
+ '--package', os.path.join(
+ repo['root'], 'infra', 'config', 'recipes.cfg'),
+ ]
+ for repo, path in overrides:
+ args.extend(['-O', '%s=%s' % (repo, path)])
+ args.extend([
+ 'simulation_test',
+ 'train',
+ ])
+ subprocess.check_output(args, stderr=subprocess.STDOUT)
+
def update_recipe(self, repo, name, deps, calls):
"""Updates or creates a recipe in given repo.
Commits the change.
@@ -205,13 +230,7 @@ class RepoTest(unittest.TestCase):
' yield api.test("basic")',
]))
- subprocess.check_output([
- sys.executable, self._recipe_tool,
- '--package', os.path.join(
- repo['root'], 'infra', 'config', 'recipes.cfg'),
- 'simulation_test',
- 'train',
- ])
+ self.train_recipes(repo)
subprocess.check_call(
['git', 'add', os.path.join(recipes_dir, '%s.py' % name)])
« no previous file with comments | « unittests/override_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698