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: |