[Python-checkins] cpython (merge 3.2 -> default): Make tests faster by reaping threads only at the end

antoine.pitrou python-checkins at python.org
Sun Aug 28 01:26:56 CEST 2011


http://hg.python.org/cpython/rev/1cd334b92064
changeset:   72109:1cd334b92064
parent:      72107:98fecf6e1972
parent:      72108:a1394fa46ff3
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sun Aug 28 01:24:22 2011 +0200
summary:
  Make tests faster by reaping threads only at the end

files:
  Lib/test/test_smtplib.py |  5 +----
  1 files changed, 1 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -177,7 +177,6 @@
         self.output = io.StringIO()
         sys.stdout = self.output
 
-        self._threads = support.threading_setup()
         self.serv_evt = threading.Event()
         self.client_evt = threading.Event()
         # Capture SMTPChannel debug output
@@ -202,7 +201,6 @@
         # wait for the server thread to terminate
         self.serv_evt.wait()
         self.thread.join()
-        support.threading_cleanup(*self._threads)
         # restore sys.stdout
         sys.stdout = self.old_stdout
         # restore DEBUGSTREAM
@@ -681,7 +679,6 @@
     def setUp(self):
         self.real_getfqdn = socket.getfqdn
         socket.getfqdn = mock_socket.getfqdn
-        self._threads = support.threading_setup()
         self.serv_evt = threading.Event()
         self.client_evt = threading.Event()
         # Pick a random unused port by passing 0 for the port number
@@ -703,7 +700,6 @@
         # wait for the server thread to terminate
         self.serv_evt.wait()
         self.thread.join()
-        support.threading_cleanup(*self._threads)
 
     def testBasic(self):
         # smoke test
@@ -816,6 +812,7 @@
     #test infrastructure can support it.
 
 
+ at support.reap_threads
 def test_main(verbose=None):
     support.run_unittest(GeneralTests, DebuggingServerTests,
                               NonConnectingTests,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list