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

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: LICENSE and small things. Created 4 years, 8 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
« recipe_engine/run.py ('K') | « 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 83a5fb7459c23e6e7e348d5dd2593b73cc535a30..f39b39410931b1af39d07f853cab95fe853c8a35 100755
--- a/unittests/errors_test.py
+++ b/unittests/errors_test.py
@@ -12,7 +12,7 @@ import unittest
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
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(
@@ -21,13 +21,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')
@@ -185,5 +186,23 @@ 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 a testproj checkout')
+ self.assertRegexpMatches(stdout, r'\./foo/bar/recipes\.py run do_nothing')
+
+
+
+
+
if __name__ == '__main__':
unittest.main()
« recipe_engine/run.py ('K') | « recipes.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698