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() |