Chromium Code Reviews| Index: scripts/slave/unittests/expect_tests/util.py |
| diff --git a/scripts/slave/unittests/expect_tests/util.py b/scripts/slave/unittests/expect_tests/util.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1061736ec57c74ace76cd931b57e6c78259333de |
| --- /dev/null |
| +++ b/scripts/slave/unittests/expect_tests/util.py |
| @@ -0,0 +1,27 @@ |
| +# Copyright 2014 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import inspect |
| + |
| +EXPECT_TESTS_COVER_FUNCTION = 'EXPECT_TESTS_COVER_FUNCTION' |
| + |
| +def covers(coverage_path_function): |
| + """Allows annotation of a Test generator function with a function that will |
| + return a list of coverage patterns which should be enabled during the use of |
| + the Test generator function. |
| + """ |
| + def _decorator(func): |
| + setattr(func, EXPECT_TESTS_COVER_FUNCTION, coverage_path_function) |
| + return func |
| + return _decorator |
| + |
| + |
| +def get_cover_list(test_gen_function): |
| + """Given a Test generator, return the list of coverage globs that should |
| + be included while executing the Test generator.""" |
| + if hasattr(test_gen_function, EXPECT_TESTS_COVER_FUNCTION): |
| + # decorated with expect_tests.covers |
| + return test_gen_function._covers() # pylint: disable=W0212 |
|
Vadim Sh.
2014/06/30 17:29:11
_covers?
But judging by another CL, you already
|
| + else: |
| + return [inspect.getabsfile(test_gen_function)] |