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

Unified Diff: unittests/test_test.py

Issue 2828823003: Detect duplicate recipe tests (Closed)
Patch Set: Created 3 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/test.py ('K') | « recipe_engine/test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittests/test_test.py
diff --git a/unittests/test_test.py b/unittests/test_test.py
index f85dd8c0b6c59af03498ecdfbfa78810adddbf02..9ef908f2cbc8e600a7c9041f5df46e74446cda12 100755
--- a/unittests/test_test.py
+++ b/unittests/test_test.py
@@ -1085,6 +1085,19 @@ class TestTest(unittest.TestCase):
self._run_recipes('test', 'run', '--json', self.json_path)
self.assertEqual(self.json_generator.get(), self.json_contents)
+ def test_test_duplicate(self):
+ rw = RecipeWriter(os.path.join(self._root_dir, 'recipes'), 'foo')
+ rw.RunStepsLines = ['pass']
+ rw.GenTestsLines = ['yield api.test("basic")'] * 2
+ rw.add_expectation('basic')
+ rw.write()
+ with self.assertRaises(subprocess.CalledProcessError) as cm:
+ self._run_recipes('test', 'run')
+ self.assertIn(
+ 'Exception: While generating results for \'foo\': '
+ 'ValueError: Duplicate test found: basic',
+ cm.exception.output)
+
def test_diff_basic(self):
g1 = self.json_generator
g2 = self.json_generator
« recipe_engine/test.py ('K') | « recipe_engine/test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698