From 7b51f55a1b633e142565b67e4ecd27f5cf223605 Mon Sep 17 00:00:00 2001 From: Steven Berler Date: Thu, 14 Jul 2011 10:59:02 -0700 Subject: [PATCH] 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. --- s3tests/rand_readwrite.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/s3tests/rand_readwrite.py b/s3tests/rand_readwrite.py index d22cc23..28b845c 100644 --- a/s3tests/rand_readwrite.py +++ b/s3tests/rand_readwrite.py @@ -32,13 +32,18 @@ class Result: else: status = 'FAILURE' + if (self.time == 0): + mbps = '?' + else: + mbps = self.size / self.time / 1024.0 + return "".format( success=status, type=type_s, name=self.name, size=self.size, time=self.time, - mbps=self.size / self.time / 1024.0, + mbps=mbps, details=self.details )