diff options
author | Steve Dower <steve.dower@microsoft.com> | 2018-05-16 21:50:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 21:50:29 (GMT) |
commit | e5f41d2f1e0b8b8e61d5fa427c19bd1ea90fd9a3 (patch) | |
tree | 08165b95d947b31d76f1dcf8fb261a167becd181 /Lib/test/test_asyncio/test_base_events.py | |
parent | 713a9367366c88662c39ed20dd6bce22399299f1 (diff) | |
download | cpython-e5f41d2f1e0b8b8e61d5fa427c19bd1ea90fd9a3.zip cpython-e5f41d2f1e0b8b8e61d5fa427c19bd1ea90fd9a3.tar.gz cpython-e5f41d2f1e0b8b8e61d5fa427c19bd1ea90fd9a3.tar.bz2 |
bpo-33522: Enable CI builds on Visual Studio Team Services (#6865)
Diffstat (limited to 'Lib/test/test_asyncio/test_base_events.py')
-rw-r--r-- | Lib/test/test_asyncio/test_base_events.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index ab6560c..72c63df 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1848,10 +1848,22 @@ class BaseLoopSockSendfileTests(test_utils.TestCase): def prepare(self): sock = self.make_socket() proto = self.MyProto(self.loop) - port = support.find_unused_port() + af = socket.AF_UNSPEC if support.IPV6_ENABLED else socket.AF_INET server = self.run_loop(self.loop.create_server( - lambda: proto, support.HOST, port)) - self.run_loop(self.loop.sock_connect(sock, (support.HOST, port))) + lambda: proto, support.HOST, 0, family=af)) + port = server.sockets[0].getsockname()[1] + + for _ in range(10): + try: + self.run_loop(self.loop.sock_connect(sock, (support.HOST, port))) + except OSError: + time.sleep(0.5) + continue + else: + break + else: + # One last try, so we get the exception + self.run_loop(self.loop.sock_connect(sock, (support.HOST, port))) def cleanup(): server.close() |