summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_smtplib.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-04-30 23:20:15 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-04-30 23:20:15 (GMT)
commit043bad00bcab7f3806e776f9402c776963536495 (patch)
treeb9e827e3f0100636a290f0bd65fe755308a98070 /Lib/test/test_smtplib.py
parentdf700f079069b16f2737dcd3cd75018fe8465e3f (diff)
downloadcpython-043bad00bcab7f3806e776f9402c776963536495.zip
cpython-043bad00bcab7f3806e776f9402c776963536495.tar.gz
cpython-043bad00bcab7f3806e776f9402c776963536495.tar.bz2
Merged revisions 80669 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80669 | antoine.pitrou | 2010-05-01 01:08:48 +0200 (sam., 01 mai 2010) | 4 lines Issue #8576: Remove use of find_unused_port() in test_smtplib and test_multiprocessing. Patch by Paul Moore. ........
Diffstat (limited to 'Lib/test/test_smtplib.py')
-rw-r--r--Lib/test/test_smtplib.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index d36ab0e..3a9de5b 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -163,8 +163,10 @@ class DebuggingServerTests(unittest.TestCase):
self._threads = support.threading_setup()
self.serv_evt = threading.Event()
self.client_evt = threading.Event()
- self.port = support.find_unused_port()
- self.serv = smtpd.DebuggingServer((HOST, self.port), ('nowhere', -1))
+ # Pick a random unused port by passing 0 for the port number
+ self.serv = smtpd.DebuggingServer((HOST, 0), ('nowhere', -1))
+ # Keep a note of what port was assigned
+ self.port = self.serv.socket.getsockname()[1]
serv_args = (self.serv, self.serv_evt, self.client_evt)
self.thread = threading.Thread(target=debugging_server, args=serv_args)
self.thread.start()
@@ -400,8 +402,10 @@ class SMTPSimTests(unittest.TestCase):
self._threads = support.threading_setup()
self.serv_evt = threading.Event()
self.client_evt = threading.Event()
- self.port = support.find_unused_port()
- self.serv = SimSMTPServer((HOST, self.port), ('nowhere', -1))
+ # Pick a random unused port by passing 0 for the port number
+ self.serv = SimSMTPServer((HOST, 0), ('nowhere', -1))
+ # Keep a note of what port was assigned
+ self.port = self.serv.socket.getsockname()[1]
serv_args = (self.serv, self.serv_evt, self.client_evt)
self.thread = threading.Thread(target=debugging_server, args=serv_args)
self.thread.start()