def test_port_already_in_use_on_worker(self): sock = get_socket_with_port() with closing(sock): port = sock.getsockname()[1] # on the worker port conflict shouldn't matter, it should just timeout # since we never created a server with self.assertRaises(IOError): create_c10d_store( is_server=False, server_addr=socket.gethostname(), server_port=port, timeout=1, )
def test_port_already_in_use_on_server(self): sock = get_socket_with_port() with closing(sock): # try to create a store on the same port without releasing the socket # should raise a IOError port = sock.getsockname()[1] with self.assertRaises(IOError): create_c10d_store( is_server=True, server_addr=socket.gethostname(), server_port=port, timeout=1, )