]> granicus.if.org Git - python/commitdiff
Fix asyncio issue #19293 (hangs on AIX).
authorGuido van Rossum <guido@dropbox.com>
Tue, 22 Oct 2013 04:28:45 +0000 (21:28 -0700)
committerGuido van Rossum <guido@dropbox.com>
Tue, 22 Oct 2013 04:28:45 +0000 (21:28 -0700)
Lib/test/test_asyncio/test_events.py

index 3924a2f996208b5e1aff4a2d059cbb5154d6b17d..98896e81d897fbdc488d9715c8e034c5c6d6b5d7 100644 (file)
@@ -887,9 +887,6 @@ class EventLoopTestsMixin:
 
     @unittest.skipUnless(sys.platform != 'win32',
                          "Don't support pipes for Windows")
-    # Issue #19293
-    @unittest.skipIf(sys.platform.startswith("aix"),
-                     'cannot be interrupted with signal on AIX')
     def test_write_pipe_disconnect_on_close(self):
         proto = None
         transport = None
@@ -899,8 +896,8 @@ class EventLoopTestsMixin:
             proto = MyWritePipeProto(loop=self.loop)
             return proto
 
-        rpipe, wpipe = os.pipe()
-        pipeobj = io.open(wpipe, 'wb', 1024)
+        rsock, wsock = self.loop._socketpair()
+        pipeobj = io.open(wsock.detach(), 'wb', 1024)
 
         @tasks.coroutine
         def connect():
@@ -916,11 +913,10 @@ class EventLoopTestsMixin:
         self.assertEqual('CONNECTED', proto.state)
 
         transport.write(b'1')
-        test_utils.run_briefly(self.loop)
-        data = os.read(rpipe, 1024)
+        data = self.loop.run_until_complete(self.loop.sock_recv(rsock, 1024))
         self.assertEqual(b'1', data)
 
-        os.close(rpipe)
+        rsock.close()
 
         self.loop.run_until_complete(proto.done)
         self.assertEqual('CLOSED', proto.state)