From 0e3a9eaf980b484a9d5f56c0f38c92164e9c5910 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 21 Jun 2013 13:43:16 +0400 Subject: [PATCH] Made Collector render property sets as dicts instead of tuples of pairs. --- modules/ts/misc/xls-report.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/ts/misc/xls-report.py b/modules/ts/misc/xls-report.py index a3cf8daca2..2dcbf89cfa 100755 --- a/modules/ts/misc/xls-report.py +++ b/modules/ts/misc/xls-report.py @@ -52,6 +52,12 @@ class Collector(object): self.config_match_func = config_match_func self.tests = {} + # Format a sorted sequence of pairs as if it was a dictionary. + # We can't just use a dictionary instead, since we want to preserve the sorted order of the keys. + @staticmethod + def __format_config_cache_key(pairs): + return '{' + ', '.join(repr(k) + ': ' + repr(v) for (k, v) in pairs) + '}' + def collect_from(self, xml_path): run = parseLogFile(xml_path) @@ -68,12 +74,15 @@ class Collector(object): configuration = self.config_match_func(properties) if configuration is None: - logging.warning('failed to match properties to a configuration: %r', props_key) + logging.warning('failed to match properties to a configuration: %s', + Collector.__format_config_cache_key(props_key)) else: same_config_props = [it[0] for it in self.__config_cache.iteritems() if it[1] == configuration] if len(same_config_props) > 0: - logging.warning('property set %r matches the same configuration %r as property set %r', - props_key, configuration, same_config_props[0]) + logging.warning('property set %s matches the same configuration %r as property set %s', + Collector.__format_config_cache_key(props_key), + configuration, + Collector.__format_config_cache_key(same_config_props[0])) self.__config_cache[props_key] = configuration