summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_unix_events.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-10-09 16:15:08 (GMT)
committerYury Selivanov <yury@magic.io>2016-10-09 16:15:08 (GMT)
commit908d55dd7e395779ed1eb5c96664aca6297fedaa (patch)
tree7a2d08224f9a43b97aa6f37ba5cc7ea728d5b127 /Lib/test/test_asyncio/test_unix_events.py
parent0aa7887f431f65f1d320c467ad9065ac2697db20 (diff)
downloadcpython-908d55dd7e395779ed1eb5c96664aca6297fedaa.zip
cpython-908d55dd7e395779ed1eb5c96664aca6297fedaa.tar.gz
cpython-908d55dd7e395779ed1eb5c96664aca6297fedaa.tar.bz2
Issue #28399: Remove UNIX socket from FS before binding.
Patch by Коренберг Марк.
Diffstat (limited to 'Lib/test/test_asyncio/test_unix_events.py')
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index 0d54e3a..ce897ed 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -241,11 +241,13 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
with test_utils.unix_socket_path() as path:
sock = socket.socket(socket.AF_UNIX)
sock.bind(path)
- with sock:
- coro = self.loop.create_unix_server(lambda: None, path)
- with self.assertRaisesRegex(OSError,
- 'Address.*is already in use'):
- self.loop.run_until_complete(coro)
+ sock.listen(1)
+ sock.close()
+
+ coro = self.loop.create_unix_server(lambda: None, path)
+ srv = self.loop.run_until_complete(coro)
+ srv.close()
+ self.loop.run_until_complete(srv.wait_closed())
def test_create_unix_server_existing_path_nonsock(self):
with tempfile.NamedTemporaryFile() as file: