@@ -444,15 +444,13 @@ def setUp(self):
444444
445445 self .ssock , self .csock = mock .Mock (), mock .Mock ()
446446
447- class EventLoop (BaseProactorEventLoop ):
448- def _socketpair (s ):
449- return (self .ssock , self .csock )
450-
451- self .loop = EventLoop (self .proactor )
447+ with mock .patch ('asyncio.proactor_events.socket.socketpair' ,
448+ return_value = (self .ssock , self .csock )):
449+ self .loop = BaseProactorEventLoop (self .proactor )
452450 self .set_event_loop (self .loop )
453451
454452 @mock .patch .object (BaseProactorEventLoop , 'call_soon' )
455- @mock .patch . object ( BaseProactorEventLoop , '_socketpair ' )
453+ @mock .patch ( 'asyncio.proactor_events.socket.socketpair ' )
456454 def test_ctor (self , socketpair , call_soon ):
457455 ssock , csock = socketpair .return_value = (
458456 mock .Mock (), mock .Mock ())
@@ -506,14 +504,6 @@ def test_sock_accept(self):
506504 self .loop .sock_accept (self .sock )
507505 self .proactor .accept .assert_called_with (self .sock )
508506
509- def test_socketpair (self ):
510- class EventLoop (BaseProactorEventLoop ):
511- # override the destructor to not log a ResourceWarning
512- def __del__ (self ):
513- pass
514- self .assertRaises (
515- NotImplementedError , EventLoop , self .proactor )
516-
517507 def test_make_socket_transport (self ):
518508 tr = self .loop ._make_socket_transport (self .sock , asyncio .Protocol ())
519509 self .assertIsInstance (tr , _ProactorSocketTransport )
0 commit comments