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

Unified Diff: tools/telemetry/third_party/coverage/tests/goldtest.py

Issue 1366913004: Add coverage Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: tools/telemetry/third_party/coverage/tests/goldtest.py
diff --git a/tools/telemetry/third_party/coverage/tests/goldtest.py b/tools/telemetry/third_party/coverage/tests/goldtest.py
new file mode 100644
index 0000000000000000000000000000000000000000..4ad4742423c42805acc0e3c4a99c34d1d64c9700
--- /dev/null
+++ b/tools/telemetry/third_party/coverage/tests/goldtest.py
@@ -0,0 +1,42 @@
+# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
+# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
+
+"""A test base class for tests based on gold file comparison."""
+
+import os
+import sys
+
+from tests.coveragetest import CoverageTest
+
+from coverage.test_helpers import change_dir # pylint: disable=unused-import
+from tests.test_farm import clean
+# Import helpers, eventually test_farm.py will go away.
+from tests.test_farm import ( # pylint: disable=unused-import
+ compare, contains, doesnt_contain, contains_any,
+)
+
+
+class CoverageGoldTest(CoverageTest):
+ """A test based on gold files."""
+
+ run_in_temp_dir = False
+
+ def setUp(self):
+ super(CoverageGoldTest, self).setUp()
+ self.chdir(self.root_dir)
+ # Modules should be importable from the current directory.
+ sys.path.insert(0, '')
+
+ def output_dir(self, the_dir):
+ """Declare where the output directory is.
+
+ The output directory is deleted at the end of the test, unless the
+ COVERAGE_KEEP_OUTPUT environment variable is set.
+
+ """
+ self.addCleanup(self.cleanup_output_dir, the_dir)
+
+ def cleanup_output_dir(self, the_dir):
+ """Clean up the output directory of the test."""
+ if not os.environ.get("COVERAGE_KEEP_OUTPUT"): # pragma: partial
+ clean(the_dir)
« no previous file with comments | « tools/telemetry/third_party/coverage/tests/farm/run/src/xxx ('k') | tools/telemetry/third_party/coverage/tests/helpers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698