File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -199,17 +199,19 @@ def on_complete(
199
199
for p in products :
200
200
on_complete (* generate_report ((p .name , settings , grouping_time_zone )))
201
201
else :
202
- with multiprocessing .Pool (workers ) as pool :
203
- summary : TimePeriodOverview | None
202
+ # Shut down pool nicely to keep pytest-cov happy.
203
+ # https://pytest-cov.readthedocs.io/en/latest/subprocess-support.html#if-you-use-multiprocessing-pool
204
+ pool = multiprocessing .Pool (workers )
205
+ try :
204
206
for product_name , result , summary in pool .imap_unordered (
205
207
generate_report ,
206
208
((p .name , settings , grouping_time_zone ) for p in products ),
207
209
chunksize = 1 ,
208
210
):
209
211
on_complete (product_name , result , summary )
210
-
211
- pool .close ()
212
- pool .join ()
212
+ finally :
213
+ pool .close ()
214
+ pool .join ()
213
215
214
216
status_messages = ", " .join (
215
217
f"{ count_ } { status .name .lower ()} " for status , count_ in counts .items ()
You can’t perform that action at this time.
0 commit comments