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

Unified Diff: tools/dm_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 | « no previous file | tools/nanobench_flags.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dm_flags.py
diff --git a/tools/dm_flags.py b/tools/dm_flags.py
index 59a3adc5e858668c5492a4b25281c30265efa560..c872b515f3f86fed24fe3b5c03ca978a7a8ed408 100755
--- a/tools/dm_flags.py
+++ b/tools/dm_flags.py
@@ -281,7 +281,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 = [
'Pretend-iOS-Bot',
@@ -305,19 +304,24 @@ def self_test():
'Test-Win7-MSVC-ShuttleA-GPU-HD2000-x86-Debug-ANGLE',
'Test-Win8-MSVC-GCE-CPU-AVX2-x86_64-Debug',
]
-
- 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 | « no previous file | tools/nanobench_flags.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698