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

Unified Diff: unittests/errors_test.py

Issue 2707593002: Whitelist allowed test names
Patch Set: Use correct regex Created 3 years, 10 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 | « recipe_engine/unittests/recipe_test_api_test.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 ab8d4a5ebf9fe4d9cb288f93d31e77e9a101c26f..fc9a1f33ed4e8153e4a746018abe1b36d76f278d 100755
--- a/unittests/errors_test.py
+++ b/unittests/errors_test.py
@@ -339,8 +339,23 @@ def RunSteps(api):
self.assertRegexpMatches(
stdout, r'\./foo/bar/recipes\.py run .* do_nothing')
+ def test_invalid_test_names(self):
+ # Full tests in recipe_engine/unittests/recipe_test_api_test.py
+ with RecipeRepo() as repo:
+ repo.make_recipe('test_recipe', """
+DEPS = []
+def RunSteps(api):
+ pass
-
+def GenTests(api):
+ yield api.test('best test')
+""")
+ subp = subprocess.Popen(
+ repo.recipes_cmd + ['simulation_test', 'test_recipe'],
+ stdout=subprocess.PIPE)
+ stdout, _ = subp.communicate()
+ self.assertIn('Traceback', stdout)
+ self.assertIn('Invalid test name', stdout)
if __name__ == '__main__':
« no previous file with comments | « recipe_engine/unittests/recipe_test_api_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698