mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
gh-113879: Fix ResourceWarning in test_asyncio.test_server (GH-113881)
This commit is contained in:
parent
1b7e0024a1
commit
ab0ad62038
1 changed files with 14 additions and 14 deletions
|
@ -200,7 +200,7 @@ class UnixServerCleanupTests(unittest.IsolatedAsyncioTestCase):
|
|||
async def serve(*args):
|
||||
pass
|
||||
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
|
||||
sock.bind(addr)
|
||||
|
||||
srv = await asyncio.start_unix_server(serve, sock=sock)
|
||||
|
@ -215,7 +215,7 @@ class UnixServerCleanupTests(unittest.IsolatedAsyncioTestCase):
|
|||
async def serve(*args):
|
||||
pass
|
||||
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
|
||||
sock.bind(addr)
|
||||
|
||||
srv = await asyncio.start_unix_server(serve, sock=sock)
|
||||
|
@ -234,7 +234,7 @@ class UnixServerCleanupTests(unittest.IsolatedAsyncioTestCase):
|
|||
srv = await asyncio.start_unix_server(serve, addr)
|
||||
|
||||
os.unlink(addr)
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
|
||||
sock.bind(addr)
|
||||
|
||||
srv.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue