@@ -283,6 +283,7 @@ def test_process(self):
283283 self .assertEqual (p .exitcode , 0 )
284284 self .assertEqual (p .is_alive (), False )
285285 self .assertNotIn (p , self .active_children ())
286+ close_queue (q )
286287
287288 @classmethod
288289 def _sleep_some (cls ):
@@ -461,6 +462,8 @@ def test_close(self):
461462 gc .collect ()
462463 self .assertIs (wr (), None )
463464
465+ close_queue (q )
466+
464467 def test_many_processes (self ):
465468 if self .TYPE == 'threads' :
466469 self .skipTest ('test not appropriate for {}' .format (self .TYPE ))
@@ -501,6 +504,7 @@ def test_lose_target_ref(self):
501504 p .join ()
502505 self .assertIs (wr (), None )
503506 self .assertEqual (q .get (), 5 )
507+ close_queue (q )
504508
505509 @classmethod
506510 def _test_child_fd_inflation (self , evt , q ):
@@ -536,6 +540,7 @@ def test_child_fd_inflation(self):
536540 evt .set ()
537541 for p in procs :
538542 p .join ()
543+ close_queue (q )
539544
540545#
541546#
@@ -721,6 +726,7 @@ def test_put(self):
721726 self .assertEqual (queue_full (queue , MAXSIZE ), False )
722727
723728 proc .join ()
729+ close_queue (queue )
724730
725731 @classmethod
726732 def _test_get (cls , queue , child_can_start , parent_can_continue ):
@@ -783,6 +789,7 @@ def test_get(self):
783789 self .assertTimingAlmostEqual (get .elapsed , TIMEOUT3 )
784790
785791 proc .join ()
792+ close_queue (queue )
786793
787794 @classmethod
788795 def _test_fork (cls , queue ):
@@ -818,6 +825,7 @@ def test_fork(self):
818825 self .assertRaises (pyqueue .Empty , queue .get , False )
819826
820827 p .join ()
828+ close_queue (queue )
821829
822830 def test_qsize (self ):
823831 q = self .Queue ()
@@ -861,6 +869,7 @@ def test_task_done(self):
861869
862870 for p in workers :
863871 p .join ()
872+ close_queue (queue )
864873
865874 def test_no_import_lock_contention (self ):
866875 with test .support .temp_cwd ():
@@ -891,6 +900,7 @@ def test_timeout(self):
891900 # Tolerate a delta of 30 ms because of the bad clock resolution on
892901 # Windows (usually 15.6 ms)
893902 self .assertGreaterEqual (delta , 0.170 )
903+ close_queue (q )
894904
895905 def test_queue_feeder_donot_stop_onexc (self ):
896906 # bpo-30414: verify feeder handles exceptions correctly
@@ -1503,6 +1513,7 @@ def test_wait_return(self):
15031513 self .run_threads (self ._test_wait_return_f , (self .barrier , queue ))
15041514 results = [queue .get () for i in range (self .N )]
15051515 self .assertEqual (results .count (0 ), 1 )
1516+ close_queue (queue )
15061517
15071518 @classmethod
15081519 def _test_action_f (cls , barrier , results ):
@@ -3158,6 +3169,8 @@ def test_access(self):
31583169 w .close ()
31593170 self .assertEqual (conn .recv (), 'foobar' * 2 )
31603171
3172+ p .join ()
3173+
31613174#
31623175#
31633176#
@@ -3654,7 +3667,7 @@ def _this_sub_process(q):
36543667 except pyqueue .Empty :
36553668 pass
36563669
3657- def _test_process (q ):
3670+ def _test_process ():
36583671 queue = multiprocessing .Queue ()
36593672 subProc = multiprocessing .Process (target = _this_sub_process , args = (queue ,))
36603673 subProc .daemon = True
@@ -3694,8 +3707,7 @@ def flush(self):
36943707class TestStdinBadfiledescriptor (unittest .TestCase ):
36953708
36963709 def test_queue_in_process (self ):
3697- queue = multiprocessing .Queue ()
3698- proc = multiprocessing .Process (target = _test_process , args = (queue ,))
3710+ proc = multiprocessing .Process (target = _test_process )
36993711 proc .start ()
37003712 proc .join ()
37013713
0 commit comments