summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-12-13 09:33:35 (GMT)
committerMarius Kintel <marius@kintel.net>2011-12-13 09:33:35 (GMT)
commitf82fef62b7eb2d4df2182fdff5e3ce01b1a65f44 (patch)
tree528c86dfd9371c02d4270299324d603f8e1f458e
parent72000cbd58deecaa4f1c5f9d5900fe1b74f56572 (diff)
parente01b9a56665e52ddb119c850fec4fb0c35c4e137 (diff)
Merge pull request #40 from donbright/master
fix div by zero bug in test_pretty_print
-rwxr-xr-xtests/test_pretty_print.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py
index 80a887a..d0c24c6 100755
--- a/tests/test_pretty_print.py
+++ b/tests/test_pretty_print.py
@@ -250,7 +250,8 @@ TESTLOG
tests_to_report = tests
if failed_only: tests_to_report = failed_tests
- percent = str(int(100.0*len(passed_tests) / len(tests)))
+ try: percent = str(int(100.0*len(passed_tests) / len(tests)))
+ except ZeroDivisionError: percent = 'n/a'
s = wiki_template
repeat1 = ezsearch('(<REPEAT1>.*?</REPEAT1>)',s)
repeat2 = ezsearch('(<REPEAT2>.*?</REPEAT2>)',s)
@@ -311,7 +312,8 @@ def tohtml(wiki_rootpath, startdate, tests, enddate, sysinfo, sysid, makefiles):
passed_tests = filter(lambda x: x.passed, tests)
failed_tests = filter(lambda x: not x.passed, tests)
- percent = str(int(100.0*len(passed_tests) / len(tests)))
+ try: percent = str(int(100.0*len(passed_tests) / len(tests)))
+ except ZeroDivisionError: percent = 'n/a'
tests_to_report = tests
if failed_only: tests_to_report = failed_tests
contact: Jan Huwald // Impressum