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

Unified Diff: expect_tests/util.py

Issue 412773002: Copy expect_tests from build (Closed) Base URL: https://chromium.googlesource.com/infra/testing/expect_tests@master
Patch Set: Fancy ast walker Created 6 years, 5 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 | « expect_tests/unittest_helper.py ('k') | requirements.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: expect_tests/util.py
diff --git a/expect_tests/util.py b/expect_tests/util.py
new file mode 100644
index 0000000000000000000000000000000000000000..fd89b4adf6e1a5785fa2b58fccac7ec2353ca14d
--- /dev/null
+++ b/expect_tests/util.py
@@ -0,0 +1,24 @@
+# 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."""
+ return getattr(test_gen_function, EXPECT_TESTS_COVER_FUNCTION,
+ lambda: [inspect.getabsfile(test_gen_function)])()
« no previous file with comments | « expect_tests/unittest_helper.py ('k') | requirements.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698