From bae2a99b3af9a4e89ae67236d96daa13c34d49d9 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 16 Oct 2013 18:28:10 -0400 Subject: [PATCH] Add filenames to skip_tracker.py output This commit adds support for also printing the filenames along with the bug number in the skip tracker output. This should make it slightly easier to find the skips and remove them. Change-Id: Ia3502f1a48bb9e028d046fa60307e398582e6124 --- tools/skip_tracker.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/tools/skip_tracker.py b/tools/skip_tracker.py index ffaf134eb0..0ae3323069 100755 --- a/tools/skip_tracker.py +++ b/tools/skip_tracker.py @@ -46,14 +46,24 @@ def find_skips(start=TESTDIR): test methods that have been decorated to skip because of a particular bug. """ - results = [] + results = {} debug("Searching in %s", start) for root, _dirs, files in os.walk(start): for name in files: if name.startswith('test_') and name.endswith('py'): path = os.path.join(root, name) debug("Searching in %s", path) - results += find_skips_in_file(path) + temp_result = find_skips_in_file(path) + for method_name, bug_no in temp_result: + if results.get(bug_no): + result_dict = results.get(bug_no) + if result_dict.get(name): + result_dict[name].append(method_name) + else: + result_dict[name] = [method_name] + results[bug_no] = result_dict + else: + results[bug_no] = {name: [method_name]} return results @@ -83,11 +93,19 @@ def find_skips_in_file(path): return results +def get_results(result_dict): + results = [] + for bug_no in result_dict.keys(): + for method in result_dict[bug_no]: + results.append((method, bug_no)) + return results + + if __name__ == '__main__': logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) results = find_skips() - unique_bugs = sorted(set([bug for (method, bug) in results])) + unique_bugs = sorted(set([bug for (method, bug) in get_results(results)])) unskips = [] duplicates = [] info("Total bug skips found: %d", len(results)) @@ -122,4 +140,7 @@ if __name__ == '__main__': print("should be removed from the test cases:") print() for bug in unskips: - print(" %7s" % bug) + message = " %7s in " % bug + locations = ["%s" % x for x in results[bug].keys()] + message += " and ".join(locations) + print(message)