fix zero devision error in readwrite test

Was dividing by 0 if somehow it managed to upload or download a file
in under .01 seconds.
This commit is contained in:
Steven Berler 2011-07-14 10:59:02 -07:00
parent 91c4f88860
commit 7b51f55a1b

View file

@ -32,13 +32,18 @@ class Result:
else: else:
status = 'FAILURE' status = 'FAILURE'
if (self.time == 0):
mbps = '?'
else:
mbps = self.size / self.time / 1024.0
return "<Result: [{success}] {type}{name} -- {size} KB in {time}s = {mbps} MB/s {details}>".format( return "<Result: [{success}] {type}{name} -- {size} KB in {time}s = {mbps} MB/s {details}>".format(
success=status, success=status,
type=type_s, type=type_s,
name=self.name, name=self.name,
size=self.size, size=self.size,
time=self.time, time=self.time,
mbps=self.size / self.time / 1024.0, mbps=mbps,
details=self.details details=self.details
) )