From d705c4ffbe60a11a0cde55f5caa2324349366bab Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 20 Dec 2015 15:11:39 +0100 Subject: [PATCH] Fix output of skipped tests. --- irctest/optional_extensions.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/irctest/optional_extensions.py b/irctest/optional_extensions.py index 0b62465..d27292b 100644 --- a/irctest/optional_extensions.py +++ b/irctest/optional_extensions.py @@ -1,6 +1,6 @@ import unittest import operator -import itertools +import collections class NotImplementedByController(unittest.SkipTest, NotImplementedError): def __str__(self): @@ -22,10 +22,11 @@ class OptionalityReportingTextTestRunner(unittest.TextTestRunner): result = super().run(test) if result.skipped: print() - print('Some tests were skipped because the following optional' + print('Some tests were skipped because the following optional ' 'specifications/mechanisms are not supported:') - msg_to_tests = itertools.groupby(result.skipped, - key=operator.itemgetter(1)) - for (msg, tests) in sorted(msg_to_tests): - print('\t{} ({} test(s))'.format(msg, sum(1 for x in tests))) + msg_to_count = collections.defaultdict(lambda: 0) + for (test, msg) in result.skipped: + msg_to_count[msg] += 1 + for (msg, count) in sorted(msg_to_count.items()): + print('\t{} ({} test(s))'.format(msg, count)) return result