Prevent division by zero in tests
If avg_time is 0, tests will fail: throughput = (size / 1000.0) / avg_time ZeroDivisionError: float division by zero This happens for me on Hurd: https://buildd.debian.org/status/fetch.php?pkg=python-pyeclib&arch=hurd-i386&ver=1.3.1-1&stamp=1475967332 Change-Id: I0a7812977173b37918f40891f6ec0a2bc7c1d023
This commit is contained in:
parent
a384e107fe
commit
ee6e409d83
@ -289,6 +289,9 @@ class TestPyECLib(unittest.TestCase):
|
||||
size_desc = size_str.split("-")
|
||||
size = float(size_desc[0])
|
||||
|
||||
if avg_time == 0:
|
||||
return '?'
|
||||
|
||||
if size_desc[1] == 'M':
|
||||
throughput = size / avg_time
|
||||
elif size_desc[1] == 'K':
|
||||
|
Loading…
x
Reference in New Issue
Block a user