Skip to content

Commit

Permalink
Fix test_asyncio for AIX - do not call transport.get_extra_info('sock…
Browse files Browse the repository at this point in the history
…name') (python#8907)
  • Loading branch information
aixtools authored and asvetlov committed Sep 13, 2018
1 parent a3c8ba7 commit 413118e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Lib/test/test_asyncio/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ def tearDownModule():
asyncio.set_event_loop_policy(None)


def osx_tiger():
def broken_unix_getsockname():
"""Return True if the platform is Mac OS 10.4 or older."""
if sys.platform != 'darwin':
if sys.platform.startswith("aix"):
return True
elif sys.platform != 'darwin':
return False
version = platform.mac_ver()[0]
version = tuple(map(int, version.split('.')))
Expand Down Expand Up @@ -617,7 +619,7 @@ def test_create_connection(self):
def test_create_unix_connection(self):
# Issue #20682: On Mac OS X Tiger, getsockname() returns a
# zero-length address for UNIX socket.
check_sockname = not osx_tiger()
check_sockname = not broken_unix_getsockname()

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

with test_utils.run_test_unix_server(use_ssl=True) as httpd:
create_connection = functools.partial(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
On AIX with AF_UNIX family sockets getsockname() does not provide 'sockname',
so skip calls to transport.get_extra_info('sockname')

0 comments on commit 413118e

Please sign in to comment.