mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
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. ........
This commit is contained in:
parent
df700f0790
commit
043bad00bc
3 changed files with 14 additions and 7 deletions
|
|
@ -1256,9 +1256,9 @@ class _TestManagerRestart(BaseTestCase):
|
||||||
|
|
||||||
def test_rapid_restart(self):
|
def test_rapid_restart(self):
|
||||||
authkey = os.urandom(32)
|
authkey = os.urandom(32)
|
||||||
port = test.support.find_unused_port()
|
|
||||||
manager = QueueManager(
|
manager = QueueManager(
|
||||||
address=('localhost', port), authkey=authkey, serializer=SERIALIZER)
|
address=('localhost', 0), authkey=authkey, serializer=SERIALIZER)
|
||||||
|
addr = manager.get_server().address
|
||||||
manager.start()
|
manager.start()
|
||||||
|
|
||||||
p = self.Process(target=self._putter, args=(manager.address, authkey))
|
p = self.Process(target=self._putter, args=(manager.address, authkey))
|
||||||
|
|
@ -1268,7 +1268,7 @@ class _TestManagerRestart(BaseTestCase):
|
||||||
del queue
|
del queue
|
||||||
manager.shutdown()
|
manager.shutdown()
|
||||||
manager = QueueManager(
|
manager = QueueManager(
|
||||||
address=('localhost', port), authkey=authkey, serializer=SERIALIZER)
|
address=addr, authkey=authkey, serializer=SERIALIZER)
|
||||||
manager.start()
|
manager.start()
|
||||||
manager.shutdown()
|
manager.shutdown()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,8 +163,10 @@ class DebuggingServerTests(unittest.TestCase):
|
||||||
self._threads = support.threading_setup()
|
self._threads = support.threading_setup()
|
||||||
self.serv_evt = threading.Event()
|
self.serv_evt = threading.Event()
|
||||||
self.client_evt = threading.Event()
|
self.client_evt = threading.Event()
|
||||||
self.port = support.find_unused_port()
|
# Pick a random unused port by passing 0 for the port number
|
||||||
self.serv = smtpd.DebuggingServer((HOST, self.port), ('nowhere', -1))
|
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)
|
serv_args = (self.serv, self.serv_evt, self.client_evt)
|
||||||
self.thread = threading.Thread(target=debugging_server, args=serv_args)
|
self.thread = threading.Thread(target=debugging_server, args=serv_args)
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
@ -400,8 +402,10 @@ class SMTPSimTests(unittest.TestCase):
|
||||||
self._threads = support.threading_setup()
|
self._threads = support.threading_setup()
|
||||||
self.serv_evt = threading.Event()
|
self.serv_evt = threading.Event()
|
||||||
self.client_evt = threading.Event()
|
self.client_evt = threading.Event()
|
||||||
self.port = support.find_unused_port()
|
# Pick a random unused port by passing 0 for the port number
|
||||||
self.serv = SimSMTPServer((HOST, self.port), ('nowhere', -1))
|
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)
|
serv_args = (self.serv, self.serv_evt, self.client_evt)
|
||||||
self.thread = threading.Thread(target=debugging_server, args=serv_args)
|
self.thread = threading.Thread(target=debugging_server, args=serv_args)
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
|
||||||
|
|
@ -1198,6 +1198,9 @@ Documentation
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Issue #8576: Remove use of find_unused_port() in test_smtplib and
|
||||||
|
test_multiprocessing. Patch by Paul Moore.
|
||||||
|
|
||||||
- Issue #7449: Fix many tests to support Python compiled without thread
|
- Issue #7449: Fix many tests to support Python compiled without thread
|
||||||
support. Patches written by Jerry Seutter.
|
support. Patches written by Jerry Seutter.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue