From 1e5b3505fb339aaa0f21f0efbb74f114e3e4e8bc Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Fri, 24 Aug 2018 20:51:18 +0000 Subject: [PATCH 1/3] Fix test_asyncio for AIX - do not call transport.get_extra_info('sockname') --- Lib/test/test_asyncio/test_events.py | 10 ++++++---- .../Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 11cd950df1cedb..77b1a9261efe9c 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -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('.'))) @@ -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( @@ -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( diff --git a/Misc/NEWS.d/next/Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst b/Misc/NEWS.d/next/Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst new file mode 100644 index 00000000000000..c778f94b5e8d11 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst @@ -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') From c0c5773fe890bf3b174deb9a39d2de9db643b591 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Sat, 25 Aug 2018 13:31:49 +0000 Subject: [PATCH 2/3] encode arg to AIX native format (iso-8859-1) for comparision --- Lib/test/test_utf8_mode.py | 2 ++ Misc/NEWS.d/next/Tests/2018-08-25-13-28-18.bpo-34347.IsRDPB.rst | 1 + 2 files changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2018-08-25-13-28-18.bpo-34347.IsRDPB.rst diff --git a/Lib/test/test_utf8_mode.py b/Lib/test/test_utf8_mode.py index 26e2e13ec5339f..3e918fd54ce3ca 100644 --- a/Lib/test/test_utf8_mode.py +++ b/Lib/test/test_utf8_mode.py @@ -219,6 +219,8 @@ def check(utf8_opt, expected, **kw): check('utf8', [arg_utf8]) if sys.platform == 'darwin' or support.is_android: c_arg = arg_utf8 + elif sys.platform.startswith("aix"): + c_arg = arg.decode('iso-8859-1') else: c_arg = arg_ascii check('utf8=0', [c_arg], LC_ALL='C') diff --git a/Misc/NEWS.d/next/Tests/2018-08-25-13-28-18.bpo-34347.IsRDPB.rst b/Misc/NEWS.d/next/Tests/2018-08-25-13-28-18.bpo-34347.IsRDPB.rst new file mode 100644 index 00000000000000..0959476b93101a --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2018-08-25-13-28-18.bpo-34347.IsRDPB.rst @@ -0,0 +1 @@ +Fix `test_utf8_mode.test_cmd_line` for AIX From addf934d6387c9f40c2669e13c9cf3e3dd17a788 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Sat, 25 Aug 2018 13:51:12 +0000 Subject: [PATCH 3/3] remove bpo-34490 changes included by accident --- Lib/test/test_asyncio/test_events.py | 10 ++++------ .../Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst | 2 -- 2 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 Misc/NEWS.d/next/Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 77b1a9261efe9c..11cd950df1cedb 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -41,11 +41,9 @@ def tearDownModule(): asyncio.set_event_loop_policy(None) -def broken_unix_getsockname(): +def osx_tiger(): """Return True if the platform is Mac OS 10.4 or older.""" - if sys.platform.startswith("aix"): - return True - elif sys.platform != 'darwin': + if sys.platform != 'darwin': return False version = platform.mac_ver()[0] version = tuple(map(int, version.split('.'))) @@ -619,7 +617,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 broken_unix_getsockname() + check_sockname = not osx_tiger() with test_utils.run_test_unix_server() as httpd: conn_fut = self.loop.create_unix_connection( @@ -750,7 +748,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 broken_unix_getsockname() + check_sockname = not osx_tiger() with test_utils.run_test_unix_server(use_ssl=True) as httpd: create_connection = functools.partial( diff --git a/Misc/NEWS.d/next/Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst b/Misc/NEWS.d/next/Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst deleted file mode 100644 index c778f94b5e8d11..00000000000000 --- a/Misc/NEWS.d/next/Tests/2018-08-24-20-23-15.bpo-34490.vb2cx4.rst +++ /dev/null @@ -1,2 +0,0 @@ -On AIX with AF_UNIX family sockets getsockname() does not provide 'sockname', -so skip calls to transport.get_extra_info('sockname')