From d4e9ed995eb7ad5050359f8822a86fc8993d659d Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Mon, 3 Jun 2019 18:03:59 -0700 Subject: [PATCH] Clean up test.run code. The file lists returned by the finder are already iterable, so there's no need to create a new list from them. If there were just wrapping them in `list()` is another possiblity. Also update the comments so they match the code better. --- HookTest/test.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/HookTest/test.py b/HookTest/test.py index 20eb5d1..fd2756c 100644 --- a/HookTest/test.py +++ b/HookTest/test.py @@ -400,11 +400,11 @@ def run(self): self.text_files, self.cts_files = self.find() self.start() - # We deal with Inventory files first to get a list of urns + # We deal with Inventory files first to get a list of urns with Pool(processes=self.workers) as executor: - # We iterate over a dictionary of completed tasks - for future in executor.imap_unordered(self.unit, [file for file in self.cts_files]): + # We iterate over the list of files, checking them in parallel. + for future in executor.imap_unordered(self.unit, self.cts_files): result, filepath, additional = future self.results[filepath] = result self.passing[filepath] = result.status @@ -416,10 +416,9 @@ def run(self): executor.join() self.middle() # To print the results from the metadata file tests - # We load a thread pool which has 5 maximum workers + # Now deal with the text files. with Pool(processes=self.workers) as executor: - # We create a dictionary of tasks which - for future in executor.imap_unordered(self.unit, [file for file in self.text_files]): + for future in executor.imap_unordered(self.unit, self.text_files): result, filepath, additional = future self.results[filepath] = result self.passing[filepath] = result.status