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))
del queue
manager.shutdown()
manager = QueueManager(
- address=('localhost', port), authkey=authkey, serializer=SERIALIZER)
+ address=addr, authkey=authkey, serializer=SERIALIZER)
manager.start()
manager.shutdown()
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()
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()
Tests
-----
+- Issue #8576: Remove use of find_unused_port() in test_smtplib and
+ test_multiprocessing. Patch by Paul Moore.
+
- Issue #8531: Skip test_ascii_formatd if ctypes module is missing
- Issue #3864: Skip three test_signal tests on freebsd6 because they fail