File tree 2 files changed +17
-0
lines changed 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -477,6 +477,8 @@ def _stop_serving(self, sock):
477
477
if path is not None :
478
478
try :
479
479
os .unlink (path )
480
+ except FileNotFoundError :
481
+ pass
480
482
except OSError as err :
481
483
logger .error ('Unable to clean up listening UNIX socket '
482
484
'%r: %r' , path , err )
Original file line number Diff line number Diff line change @@ -175,6 +175,21 @@ async def serve(*args):
175
175
srv .close ()
176
176
self .assertFalse (os .path .exists (addr ))
177
177
178
+ @socket_helper .skip_unless_bind_unix_socket
179
+ async def test_unix_server_cleanup_gone (self ):
180
+ with test_utils .unix_socket_path () as addr :
181
+ async def serve (* args ):
182
+ pass
183
+
184
+ sock = socket .socket (socket .AF_UNIX , socket .SOCK_STREAM )
185
+ sock .bind (addr )
186
+
187
+ srv = await asyncio .start_unix_server (serve , sock = sock )
188
+
189
+ os .unlink (addr )
190
+
191
+ srv .close ()
192
+
178
193
179
194
@unittest .skipUnless (hasattr (asyncio , 'ProactorEventLoop' ), 'Windows only' )
180
195
class ProactorStartServerTests (BaseStartServer , unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments