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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « recipe_engine/unittests/recipe_test_api_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The LUCI Authors. All rights reserved. 2 # Copyright 2014 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 import json 6 import json
7 import os 7 import os
8 import shutil 8 import shutil
9 import subprocess 9 import subprocess
10 import tempfile 10 import tempfile
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 """) 332 """)
333 subp = subprocess.Popen( 333 subp = subprocess.Popen(
334 repo.recipes_cmd + ['run', 'do_nothing'], 334 repo.recipes_cmd + ['run', 'do_nothing'],
335 stdout=subprocess.PIPE) 335 stdout=subprocess.PIPE)
336 stdout, _ = subp.communicate() 336 stdout, _ = subp.communicate()
337 self.assertRegexpMatches( 337 self.assertRegexpMatches(
338 stdout, r'from the root of a \'testproj\' checkout') 338 stdout, r'from the root of a \'testproj\' checkout')
339 self.assertRegexpMatches( 339 self.assertRegexpMatches(
340 stdout, r'\./foo/bar/recipes\.py run .* do_nothing') 340 stdout, r'\./foo/bar/recipes\.py run .* do_nothing')
341 341
342 def test_invalid_test_names(self):
343 # Full tests in recipe_engine/unittests/recipe_test_api_test.py
344 with RecipeRepo() as repo:
345 repo.make_recipe('test_recipe', """
346 DEPS = []
347 def RunSteps(api):
348 pass
342 349
343 350 def GenTests(api):
351 yield api.test('best test')
352 """)
353 subp = subprocess.Popen(
354 repo.recipes_cmd + ['simulation_test', 'test_recipe'],
355 stdout=subprocess.PIPE)
356 stdout, _ = subp.communicate()
357 self.assertIn('Traceback', stdout)
358 self.assertIn('Invalid test name', stdout)
344 359
345 360
346 if __name__ == '__main__': 361 if __name__ == '__main__':
347 unittest.main() 362 unittest.main()
OLDNEW
« 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