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

Unified Diff: tools/nanobench_flags.py

Issue 2184423002: Make coverage.py optional for dm and nanobench _flags.py (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « tools/dm_flags.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/nanobench_flags.py
diff --git a/tools/nanobench_flags.py b/tools/nanobench_flags.py
index 41779efaa4ac566101a35d46df216a841ac14054..248e0147c7cb5373b97fc0c7858249a2ca6cc8bd 100755
--- a/tools/nanobench_flags.py
+++ b/tools/nanobench_flags.py
@@ -144,7 +144,6 @@ cov_end = lineno() # Don't care about code coverage past here.
def self_test():
- import coverage # This way the bots don't need coverage.py to be installed.
args = {}
cases = [
'Perf-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Release',
@@ -160,18 +159,23 @@ def self_test():
'Perf-Android-GCC-Nexus5-GPU-Adreno330-Arm7-Release',
]
- cov = coverage.coverage()
- cov.start()
- for case in cases:
- args[case] = get_args(case)
- cov.stop()
-
this_file = os.path.basename(__file__)
- _, _, not_run, _ = cov.analysis(this_file)
- filtered = [line for line in not_run if line > cov_start and line < cov_end]
- if filtered:
- print 'Lines not covered by test cases: ', filtered
- sys.exit(1)
+ try:
+ import coverage
+ cov = coverage.coverage()
+ cov.start()
+ for case in cases:
+ args[case] = get_args(case)
+ cov.stop()
+
+ _, _, not_run, _ = cov.analysis(this_file)
+ filtered = [line for line in not_run if line > cov_start and line < cov_end]
+ if filtered:
+ print 'Lines not covered by test cases: ', filtered
+ sys.exit(1)
+ except ImportError:
+ print ("We cannot guarantee that this files tests are comprehensive " +
+ "without coverage.py. Please install it when you get a chance.")
golden = this_file.replace('.py', '.json')
with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f:
« no previous file with comments | « tools/dm_flags.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698