Skip to content

Commit

Permalink
Merge pull request #146 from rillian/run-cleanup
Browse files Browse the repository at this point in the history
Clean up test.run code.
  • Loading branch information
PonteIneptique authored Jul 1, 2019
2 parents 0124001 + 93a3238 commit 517cae2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions HookTest/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 517cae2

Please sign in to comment.