Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d54fa55

Browse files
committed
Make tests faster by reaping threads only at the end
1 parent 6b2e160 commit d54fa55

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

Lib/test/test_smtplib.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ def setUp(self):
169169
self.output = io.StringIO()
170170
sys.stdout = self.output
171171

172-
self._threads = support.threading_setup()
173172
self.serv_evt = threading.Event()
174173
self.client_evt = threading.Event()
175174
# Capture SMTPChannel debug output
@@ -194,7 +193,6 @@ def tearDown(self):
194193
# wait for the server thread to terminate
195194
self.serv_evt.wait()
196195
self.thread.join()
197-
support.threading_cleanup(*self._threads)
198196
# restore sys.stdout
199197
sys.stdout = self.old_stdout
200198
# restore DEBUGSTREAM
@@ -644,7 +642,6 @@ class SMTPSimTests(unittest.TestCase):
644642
def setUp(self):
645643
self.real_getfqdn = socket.getfqdn
646644
socket.getfqdn = mock_socket.getfqdn
647-
self._threads = support.threading_setup()
648645
self.serv_evt = threading.Event()
649646
self.client_evt = threading.Event()
650647
# Pick a random unused port by passing 0 for the port number
@@ -666,7 +663,6 @@ def tearDown(self):
666663
# wait for the server thread to terminate
667664
self.serv_evt.wait()
668665
self.thread.join()
669-
support.threading_cleanup(*self._threads)
670666

671667
def testBasic(self):
672668
# smoke test
@@ -760,6 +756,7 @@ def testAUTH_CRAM_MD5(self):
760756
#test infrastructure can support it.
761757

762758

759+
@support.reap_threads
763760
def test_main(verbose=None):
764761
support.run_unittest(GeneralTests, DebuggingServerTests,
765762
NonConnectingTests,

0 commit comments

Comments
 (0)