summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMichael Felt <aixtools@users.noreply.github.com>2018-12-26 03:34:37 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2018-12-26 03:34:37 (GMT)
commit5661459f5f508ea4bd24c13cbc861543f283147e (patch)
treedd8b1ea21e03eb87d9d5b2f9dbbd90cb8293d79a /Lib
parent56edf3a4b145d80684a9e4ba7411a6778d830140 (diff)
downloadcpython-5661459f5f508ea4bd24c13cbc861543f283147e.zip
cpython-5661459f5f508ea4bd24c13cbc861543f283147e.tar.gz
cpython-5661459f5f508ea4bd24c13cbc861543f283147e.tar.bz2
bpo-11192: Skip unsupported cases in test_socket on AIX (GH-8954)
* use platform.system() as runtime test, rather than sys.platform() build-time test * IPv6 zone id support on AIX is limited to inet_pton6_zone(), so skip related getaddrinfo() and getnameinfo() tests as not supported
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_socket.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index bfbd1cc..36d3d5e 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -12,6 +12,7 @@ import traceback
import queue
import sys
import os
+import platform
import array
import contextlib
from weakref import proxy
@@ -39,6 +40,7 @@ MSG = 'Michael Gilfix was here\u1234\r\n'.encode('utf-8')
MAIN_TIMEOUT = 60.0
VSOCKPORT = 1234
+AIX = platform.system() == "AIX"
try:
import _socket
@@ -1116,7 +1118,7 @@ class GeneralModuleTests(unittest.TestCase):
self.assertEqual(b'\x01\x02\x03\x04', f('1.2.3.4'))
self.assertEqual(b'\xff\xff\xff\xff', f('255.255.255.255'))
# bpo-29972: inet_pton() doesn't fail on AIX
- if not sys.platform.startswith('aix'):
+ if not AIX:
assertInvalid(f, '0.0.0.')
assertInvalid(f, '300.0.0.0')
assertInvalid(f, 'a.0.0.0')
@@ -1173,10 +1175,10 @@ class GeneralModuleTests(unittest.TestCase):
assertInvalid('1::abc::')
assertInvalid('1::abc::def')
assertInvalid('1:2:3:4:5:6')
+ assertInvalid('1:2:3:4:5:6:')
assertInvalid('1:2:3:4:5:6:7:8:0')
# bpo-29972: inet_pton() doesn't fail on AIX
- if not sys.platform.startswith('aix'):
- assertInvalid('1:2:3:4:5:6:')
+ if not AIX:
assertInvalid('1:2:3:4:5:6:7:8:')
self.assertEqual(b'\x00' * 12 + b'\xfe\x2a\x17\x40',
@@ -1625,6 +1627,7 @@ class GeneralModuleTests(unittest.TestCase):
@unittest.skipUnless(
hasattr(socket, 'if_nameindex'),
'if_nameindex is not supported')
+ @unittest.skipIf(AIX, 'Symbolic scope id does not work')
def test_getaddrinfo_ipv6_scopeid_symbolic(self):
# Just pick up any network interface (Linux, Mac OS X)
(ifindex, test_interface) = socket.if_nameindex()[0]
@@ -1658,6 +1661,7 @@ class GeneralModuleTests(unittest.TestCase):
@unittest.skipUnless(
hasattr(socket, 'if_nameindex'),
'if_nameindex is not supported')
+ @unittest.skipIf(AIX, 'Symbolic scope id does not work')
def test_getnameinfo_ipv6_scopeid_symbolic(self):
# Just pick up any network interface.
(ifindex, test_interface) = socket.if_nameindex()[0]
@@ -1666,8 +1670,7 @@ class GeneralModuleTests(unittest.TestCase):
self.assertEqual(nameinfo, ('ff02::1de:c0:face:8d%' + test_interface, '1234'))
@unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.')
- @unittest.skipUnless(
- sys.platform == 'win32',
+ @unittest.skipUnless( sys.platform == 'win32',
'Numeric scope id does not work or undocumented')
def test_getnameinfo_ipv6_scopeid_numeric(self):
# Also works on Linux (undocumented), but does not work on Mac OS X
@@ -3238,7 +3241,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
self.createAndSendFDs(1)
@unittest.skipIf(sys.platform == "darwin", "skipping, see issue #12958")
- @unittest.skipIf(sys.platform.startswith("aix"), "skipping, see issue #22397")
+ @unittest.skipIf(AIX, "skipping, see issue #22397")
@requireAttrs(socket, "CMSG_SPACE")
def testFDPassSeparate(self):
# Pass two FDs in two separate arrays. Arrays may be combined
@@ -3249,7 +3252,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
@testFDPassSeparate.client_skip
@unittest.skipIf(sys.platform == "darwin", "skipping, see issue #12958")
- @unittest.skipIf(sys.platform.startswith("aix"), "skipping, see issue #22397")
+ @unittest.skipIf(AIX, "skipping, see issue #22397")
def _testFDPassSeparate(self):
fd0, fd1 = self.newFDs(2)
self.assertEqual(
@@ -3262,7 +3265,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
len(MSG))
@unittest.skipIf(sys.platform == "darwin", "skipping, see issue #12958")
- @unittest.skipIf(sys.platform.startswith("aix"), "skipping, see issue #22397")
+ @unittest.skipIf(AIX, "skipping, see issue #22397")
@requireAttrs(socket, "CMSG_SPACE")
def testFDPassSeparateMinSpace(self):
# Pass two FDs in two separate arrays, receiving them into the
@@ -3276,7 +3279,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
@testFDPassSeparateMinSpace.client_skip
@unittest.skipIf(sys.platform == "darwin", "skipping, see issue #12958")
- @unittest.skipIf(sys.platform.startswith("aix"), "skipping, see issue #22397")
+ @unittest.skipIf(AIX, "skipping, see issue #22397")
def _testFDPassSeparateMinSpace(self):
fd0, fd1 = self.newFDs(2)
self.assertEqual(
@@ -3997,11 +4000,13 @@ class SendrecvmsgSCTPStreamTestBase(SendrecvmsgSCTPFlagsBase,
pass
@requireAttrs(socket.socket, "sendmsg")
+@unittest.skipIf(AIX, "IPPROTO_SCTP: [Errno 62] Protocol not supported on AIX")
@requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP")
class SendmsgSCTPStreamTest(SendmsgStreamTests, SendrecvmsgSCTPStreamTestBase):
pass
@requireAttrs(socket.socket, "recvmsg")
+@unittest.skipIf(AIX, "IPPROTO_SCTP: [Errno 62] Protocol not supported on AIX")
@requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP")
class RecvmsgSCTPStreamTest(RecvmsgTests, RecvmsgGenericStreamTests,
SendrecvmsgSCTPStreamTestBase):
@@ -4015,6 +4020,7 @@ class RecvmsgSCTPStreamTest(RecvmsgTests, RecvmsgGenericStreamTests,
self.skipTest("sporadic ENOTCONN (kernel issue?) - see issue #13876")
@requireAttrs(socket.socket, "recvmsg_into")
+@unittest.skipIf(AIX, "IPPROTO_SCTP: [Errno 62] Protocol not supported on AIX")
@requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP")
class RecvmsgIntoSCTPStreamTest(RecvmsgIntoTests, RecvmsgGenericStreamTests,
SendrecvmsgSCTPStreamTestBase):