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

Unified Diff: unittests/errors_test.py

Issue 1861203002: Make recipes.py run give better messages. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Fix test, remove unneeded description. Created 4 years, 4 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 | « recipes.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittests/errors_test.py
diff --git a/unittests/errors_test.py b/unittests/errors_test.py
index 2051b1c73f8190a1fa87fbf036a550d8a5ea4c6b..f7b8ae4512cd248d1ad9f80a3d6950c1adebc15f 100755
--- a/unittests/errors_test.py
+++ b/unittests/errors_test.py
@@ -14,7 +14,7 @@ from repo_test_util import ROOT_DIR
class RecipeRepo(object):
- def __init__(self):
+ def __init__(self, recipes_path=''):
self._root = tempfile.mkdtemp()
os.makedirs(os.path.join(self._root, 'infra', 'config'))
self._recipes_cfg = os.path.join(
@@ -23,13 +23,14 @@ class RecipeRepo(object):
fh.write("""
api_version: 1
project_id: "testproj"
+recipes_path: "%s"
deps {
project_id: "recipe_engine"
url: "%s"
branch: "master"
revision: "HEAD"
}
-""" % ROOT_DIR)
+""" % (recipes_path, ROOT_DIR))
self._recipes_dir = os.path.join(self._root, 'recipes')
os.mkdir(self._recipes_dir)
self._modules_dir = os.path.join(self._root, 'recipe_modules')
@@ -187,5 +188,25 @@ def GenTests(api):
stdout + stderr, 'Unconsumed'),
retcode=1)
+ def test_run_recipe_help(self):
+ with RecipeRepo(recipes_path='foo/bar') as repo:
+ repo.make_recipe('do_nothing', """
+DEPS = []
+def RunSteps(api):
+ pass
+""")
+ subp = subprocess.Popen(
+ repo.recipes_cmd + ['run', 'do_nothing'],
+ stdout=subprocess.PIPE)
+ stdout, _ = subp.communicate()
+ self.assertRegexpMatches(
+ stdout, r'from the root of a \'testproj\' checkout')
+ self.assertRegexpMatches(
+ stdout, r'\./foo/bar/recipes\.py run .* do_nothing')
+
+
+
+
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « recipes.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698