@@ -619,6 +619,7 @@ def test_path_objects(self):
619
619
620
620
@unittest .skipIf (os .name == 'nt' , 'WatchedFileHandler not appropriate for Windows.' )
621
621
@unittest .skipUnless (threading , 'Threading required for this test.' )
622
+ @support .reap_threads
622
623
def test_race (self ):
623
624
# Issue #14632 refers.
624
625
def remove_loop (fname , tries ):
@@ -776,7 +777,10 @@ def stop(self, timeout=None):
776
777
"""
777
778
self .close ()
778
779
self ._thread .join (timeout )
780
+ alive = self ._thread .is_alive ()
779
781
self ._thread = None
782
+ if alive :
783
+ self .fail ("join() timed out" )
780
784
781
785
class ControlMixin (object ):
782
786
"""
@@ -827,7 +831,10 @@ def stop(self, timeout=None):
827
831
self .shutdown ()
828
832
if self ._thread is not None :
829
833
self ._thread .join (timeout )
834
+ alive = self ._thread .is_alive ()
830
835
self ._thread = None
836
+ if alive :
837
+ self .fail ("join() timed out" )
831
838
self .server_close ()
832
839
self .ready .clear ()
833
840
@@ -962,6 +969,8 @@ class TestUnixDatagramServer(TestUDPServer):
962
969
@unittest .skipUnless (threading , 'Threading required for this test.' )
963
970
class SMTPHandlerTest (BaseTest ):
964
971
TIMEOUT = 8.0
972
+
973
+ @support .reap_threads
965
974
def test_basic (self ):
966
975
sockmap = {}
967
976
server = TestSMTPServer ((support .HOST , 0 ), self .process_message , 0.001 ,
@@ -1752,6 +1761,7 @@ def handle_request(self, request):
1752
1761
request .end_headers ()
1753
1762
self .handled .set ()
1754
1763
1764
+ @support .reap_threads
1755
1765
def test_output (self ):
1756
1766
# The log message sent to the HTTPHandler is properly received.
1757
1767
logger = logging .getLogger ("http" )
@@ -2863,8 +2873,11 @@ def setup_via_listener(self, text, verify=None):
2863
2873
t .ready .wait (2.0 )
2864
2874
logging .config .stopListening ()
2865
2875
t .join (2.0 )
2876
+ if t .is_alive ():
2877
+ self .fail ("join() timed out" )
2866
2878
2867
2879
@unittest .skipUnless (threading , 'Threading required for this test.' )
2880
+ @support .reap_threads
2868
2881
def test_listen_config_10_ok (self ):
2869
2882
with support .captured_stdout () as output :
2870
2883
self .setup_via_listener (json .dumps (self .config10 ))
@@ -2885,6 +2898,7 @@ def test_listen_config_10_ok(self):
2885
2898
], stream = output )
2886
2899
2887
2900
@unittest .skipUnless (threading , 'Threading required for this test.' )
2901
+ @support .reap_threads
2888
2902
def test_listen_config_1_ok (self ):
2889
2903
with support .captured_stdout () as output :
2890
2904
self .setup_via_listener (textwrap .dedent (ConfigFileTest .config1 ))
@@ -2900,6 +2914,7 @@ def test_listen_config_1_ok(self):
2900
2914
self .assert_log_lines ([])
2901
2915
2902
2916
@unittest .skipUnless (threading , 'Threading required for this test.' )
2917
+ @support .reap_threads
2903
2918
def test_listen_verify (self ):
2904
2919
2905
2920
def verify_fail (stuff ):
0 commit comments