Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2017 The LUCI Authors. All rights reserved. | 1 # Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 from __future__ import print_function | 5 from __future__ import print_function |
| 6 | 6 |
| 7 import argparse | 7 import argparse |
| 8 import bdb | 8 import bdb |
| 9 import cStringIO | 9 import cStringIO |
| 10 import contextlib | 10 import contextlib |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 # the function definition, not GenTests body. | 402 # the function definition, not GenTests body. |
| 403 recipe_tests = list(recipe.gen_tests(test_api)) | 403 recipe_tests = list(recipe.gen_tests(test_api)) |
| 404 coverage_data.update(cov.get_data()) | 404 coverage_data.update(cov.get_data()) |
| 405 | 405 |
| 406 for test_data in recipe_tests: | 406 for test_data in recipe_tests: |
| 407 # Put the test data in shared cache. This way it can only be generated | 407 # Put the test data in shared cache. This way it can only be generated |
| 408 # once. We do this primarily for _correctness_ , for example in case | 408 # once. We do this primarily for _correctness_ , for example in case |
| 409 # a weird recipe generates tests non-deterministically. The recipe | 409 # a weird recipe generates tests non-deterministically. The recipe |
| 410 # engine should be robust against such user recipe code where | 410 # engine should be robust against such user recipe code where |
| 411 # reasonable. | 411 # reasonable. |
| 412 _GEN_TEST_CACHE[(recipe_name, test_data.name)] = copy.deepcopy( | 412 key = (recipe_name, test_data.name) |
| 413 test_data) | 413 if key in _GEN_TEST_CACHE: |
| 414 raise ValueError('Duplicate test found: %s' % test_data.name) | |
|
iannucci1
2017/04/19 18:12:42
I think the error should indicate which recipe the
Paweł Hajdan Jr.
2017/04/19 18:17:06
It does, please see the test:
Exception: While ge
| |
| 415 _GEN_TEST_CACHE[key] = copy.deepcopy(test_data) | |
| 414 | 416 |
| 415 test_description = TestDescription( | 417 test_description = TestDescription( |
| 416 recipe_name, test_data.name, expect_dir, covers) | 418 recipe_name, test_data.name, expect_dir, covers) |
| 417 if test_filter: | 419 if test_filter: |
| 418 for pattern in test_filter: | 420 for pattern in test_filter: |
| 419 if fnmatch.fnmatch(test_description.full_name, pattern): | 421 if fnmatch.fnmatch(test_description.full_name, pattern): |
| 420 tests.append(test_description) | 422 tests.append(test_description) |
| 421 break | 423 break |
| 422 else: | 424 else: |
| 423 tests.append(test_description) | 425 tests.append(test_description) |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 901 Returns: | 903 Returns: |
| 902 Exit code | 904 Exit code |
| 903 """ | 905 """ |
| 904 global _UNIVERSE_VIEW | 906 global _UNIVERSE_VIEW |
| 905 _UNIVERSE_VIEW = universe_view | 907 _UNIVERSE_VIEW = universe_view |
| 906 global _ENGINE_FLAGS | 908 global _ENGINE_FLAGS |
| 907 _ENGINE_FLAGS = engine_flags | 909 _ENGINE_FLAGS = engine_flags |
| 908 | 910 |
| 909 args = parse_args(raw_args) | 911 args = parse_args(raw_args) |
| 910 return args.func(args) | 912 return args.func(args) |
| OLD | NEW |