Skip to content

Commit 413118e

Browse files
aixtoolsasvetlov
authored andcommitted
Fix test_asyncio for AIX - do not call transport.get_extra_info('sockname') (#8907)
1 parent a3c8ba7 commit 413118e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Lib/test/test_asyncio/test_events.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ def tearDownModule():
4141
asyncio.set_event_loop_policy(None)
4242

4343

44-
def osx_tiger():
44+
def broken_unix_getsockname():
4545
"""Return True if the platform is Mac OS 10.4 or older."""
46-
if sys.platform != 'darwin':
46+
if sys.platform.startswith("aix"):
47+
return True
48+
elif sys.platform != 'darwin':
4749
return False
4850
version = platform.mac_ver()[0]
4951
version = tuple(map(int, version.split('.')))
@@ -617,7 +619,7 @@ def test_create_connection(self):
617619
def test_create_unix_connection(self):
618620
# Issue #20682: On Mac OS X Tiger, getsockname() returns a
619621
# zero-length address for UNIX socket.
620-
check_sockname = not osx_tiger()
622+
check_sockname = not broken_unix_getsockname()
621623

622624
with test_utils.run_test_unix_server() as httpd:
623625
conn_fut = self.loop.create_unix_connection(
@@ -748,7 +750,7 @@ def test_create_ssl_connection(self):
748750
def test_create_ssl_unix_connection(self):
749751
# Issue #20682: On Mac OS X Tiger, getsockname() returns a
750752
# zero-length address for UNIX socket.
751-
check_sockname = not osx_tiger()
753+
check_sockname = not broken_unix_getsockname()
752754

753755
with test_utils.run_test_unix_server(use_ssl=True) as httpd:
754756
create_connection = functools.partial(
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
On AIX with AF_UNIX family sockets getsockname() does not provide 'sockname',
2+
so skip calls to transport.get_extra_info('sockname')

0 commit comments

Comments
 (0)