From e01b9a56665e52ddb119c850fec4fb0c35c4e137 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Mon, 12 Dec 2011 19:57:39 -0600 Subject: [PATCH] fix div by zero bug in test_pretty_print --- tests/test_pretty_print.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py index 80a887ae..d0c24c63 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('(.*?)',s) repeat2 = ezsearch('(.*?)',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