Catch exception trying to extract test time

The database I am getting back is a gdm database and it does
not have a get method.  Catch the exception and try something
else.  If that blows up, ignore because we'd rather see the
results of our tests.

Change-Id: I2882e19d49f2fb3471669f5eb8a017c5d5ac98c2
This commit is contained in:
TerryHowe 2015-06-01 13:28:53 -06:00
parent 9832648353
commit de604832c3

View File

@ -131,7 +131,14 @@ def find_test_run_time_diff(test_id, run_time):
test_times = dbm.open(times_db_path)
except Exception:
return False
avg_runtime = float(test_times.get(str(test_id), False))
try:
avg_runtime = float(test_times.get(str(test_id), False))
except Exception:
try:
avg_runtime = float(test_times[str(test_id)])
except Exception:
avg_runtime = False
if avg_runtime and avg_runtime > 0:
run_time = float(run_time.rstrip('s'))
perc_diff = ((run_time - avg_runtime) / avg_runtime) * 100