Skip to content

Commit 8eee4c5

Browse files
committed
Explicitly use an unused port in test_connect_failed()
Instead of guessing to find an unused port, use helper.unused_port() to find one. The test might otherwise fail if something is listening in the high ports and the Client collides with it.
1 parent c7e32fd commit 8eee4c5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

test/test_msgpackrpc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ def test_async_result(self):
168168

169169
def test_connect_failed(self):
170170
client = self.setup_env();
171-
client = msgpackrpc.Client(msgpackrpc.Address('localhost', self._address.port - 10), unpack_encoding='utf-8')
171+
port = helper.unused_port()
172+
client = msgpackrpc.Client(msgpackrpc.Address('localhost', port), unpack_encoding='utf-8')
172173
self.assertRaises(error.TransportError, lambda: client.call('hello'))
173174

174175
def test_timeout(self):

0 commit comments

Comments
 (0)