Skip to content

Commit 4afe59e

Browse files
committed
Fix tests to run on Python 3.5.0
1 parent 629cdab commit 4afe59e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/test_tcp.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,15 @@ async def start_server():
5151
nonlocal CNT
5252
CNT = 0
5353

54+
addrs = ('127.0.0.1', 'localhost')
55+
if not isinstance(self.loop, uvloop._Loop):
56+
# Hack to let tests run on Python 3.5.0
57+
# (asyncio doesn't support multiple hosts in 3.5.0)
58+
addrs = '127.0.0.1'
59+
5460
srv = await asyncio.start_server(
5561
handle_client,
56-
('127.0.0.1', 'localhost'), 0,
62+
addrs, 0,
5763
family=socket.AF_INET,
5864
loop=self.loop)
5965

@@ -356,9 +362,9 @@ async def test_client(addr):
356362

357363
t.write(b'OK') # We want server to fail.
358364

359-
self.assertFalse(t.is_closing())
365+
self.assertFalse(t._closing)
360366
t.abort()
361-
self.assertTrue(t.is_closing())
367+
self.assertTrue(t._closing)
362368

363369
await fut
364370

0 commit comments

Comments
 (0)