@@ -221,17 +221,17 @@ def test_create_unix_server_existing_path_sock(self):
221
221
with test_utils .unix_socket_path () as path :
222
222
sock = socket .socket (socket .AF_UNIX )
223
223
sock .bind (path )
224
-
225
- coro = self .loop .create_unix_server (lambda : None , path )
226
- with self .assertRaisesRegexp (OSError ,
227
- 'Address.*is already in use' ):
228
- self .loop .run_until_complete (coro )
224
+ with sock :
225
+ coro = self .loop .create_unix_server (lambda : None , path )
226
+ with self .assertRaisesRegex (OSError ,
227
+ 'Address.*is already in use' ):
228
+ self .loop .run_until_complete (coro )
229
229
230
230
def test_create_unix_server_existing_path_nonsock (self ):
231
231
with tempfile .NamedTemporaryFile () as file :
232
232
coro = self .loop .create_unix_server (lambda : None , file .name )
233
- with self .assertRaisesRegexp (OSError ,
234
- 'Address.*is already in use' ):
233
+ with self .assertRaisesRegex (OSError ,
234
+ 'Address.*is already in use' ):
235
235
self .loop .run_until_complete (coro )
236
236
237
237
def test_create_unix_server_ssl_bool (self ):
@@ -248,11 +248,13 @@ def test_create_unix_server_nopath_nosock(self):
248
248
self .loop .run_until_complete (coro )
249
249
250
250
def test_create_unix_server_path_inetsock (self ):
251
- coro = self .loop .create_unix_server (lambda : None , path = None ,
252
- sock = socket .socket ())
253
- with self .assertRaisesRegex (ValueError ,
254
- 'A UNIX Domain Socket was expected' ):
255
- self .loop .run_until_complete (coro )
251
+ sock = socket .socket ()
252
+ with sock :
253
+ coro = self .loop .create_unix_server (lambda : None , path = None ,
254
+ sock = sock )
255
+ with self .assertRaisesRegex (ValueError ,
256
+ 'A UNIX Domain Socket was expected' ):
257
+ self .loop .run_until_complete (coro )
256
258
257
259
def test_create_unix_connection_path_sock (self ):
258
260
coro = self .loop .create_unix_connection (
@@ -278,7 +280,7 @@ def test_create_unix_connection_ssl_noserverhost(self):
278
280
coro = self .loop .create_unix_connection (
279
281
lambda : None , '/dev/null' , ssl = True )
280
282
281
- with self .assertRaisesRegexp (
283
+ with self .assertRaisesRegex (
282
284
ValueError , 'you have to pass server_hostname when using ssl' ):
283
285
284
286
self .loop .run_until_complete (coro )
0 commit comments