summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-04-30 23:23:38 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-04-30 23:23:38 (GMT)
commita751c3fcb85b91772485b87948ef45477d01a61a (patch)
tree7e73fbcdf8ebe75e5bc5072752ea1d7db8ed7537 /Lib
parentcaac2609df592daa8496fc7065440f82d070b14d (diff)
downloadcpython-a751c3fcb85b91772485b87948ef45477d01a61a.zip
cpython-a751c3fcb85b91772485b87948ef45477d01a61a.tar.gz
cpython-a751c3fcb85b91772485b87948ef45477d01a61a.tar.bz2
Merged revisions 80671 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r80671 | antoine.pitrou | 2010-05-01 01:20:15 +0200 (sam., 01 mai 2010) | 10 lines 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')
-rw-r--r--Lib/test/test_multiprocessing.py6
-rw-r--r--Lib/test/test_smtplib.py12
2 files changed, 11 insertions, 7 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index f901a05..c5aeb14 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -1221,9 +1221,9 @@ class _TestManagerRestart(BaseTestCase):
def test_rapid_restart(self):
authkey = os.urandom(32)
- port = test.support.find_unused_port()
manager = QueueManager(
- address=('localhost', port), authkey=authkey, serializer=SERIALIZER)
+ address=('localhost', 0), authkey=authkey, serializer=SERIALIZER)
+ addr = manager.get_server().address
manager.start()
p = self.Process(target=self._putter, args=(manager.address, authkey))
@@ -1233,7 +1233,7 @@ class _TestManagerRestart(BaseTestCase):
del queue
manager.shutdown()
manager = QueueManager(
- address=('localhost', port), authkey=authkey, serializer=SERIALIZER)
+ address=addr, authkey=authkey, serializer=SERIALIZER)
manager.start()
manager.shutdown()
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index fff319d..727ef83 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -152,8 +152,10 @@ class DebuggingServerTests(TestCase):
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)
threading.Thread(target=debugging_server, args=serv_args).start()
@@ -379,8 +381,10 @@ class SMTPSimTests(TestCase):
def setUp(self):
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)
threading.Thread(target=debugging_server, args=serv_args).start()