summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-25 15:11:23 (GMT)
committerGuido van Rossum <guido@python.org>2003-04-25 15:11:23 (GMT)
commitf4001eed3bd07f62807120397629317f957a0bf6 (patch)
tree7c8122652dfa6f6b58c621cfcf6feaa2d5eb8008 /Lib/test
parent51735b0569e4bff3f9a2988f0273cd5f1e3ec471 (diff)
downloadcpython-f4001eed3bd07f62807120397629317f957a0bf6.zip
cpython-f4001eed3bd07f62807120397629317f957a0bf6.tar.gz
cpython-f4001eed3bd07f62807120397629317f957a0bf6.tar.bz2
Skip testing inet_ntop() an inet_pton() if they aren't defined.
This makes the test pass on Windows again (and on other platforms that don't have these).
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_socket.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 16a3989..279fd90 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -319,6 +319,8 @@ class GeneralModuleTests(unittest.TestCase):
self.assertRaises(TypeError, socket.setdefaulttimeout, "spam")
def testIPv4toString(self):
+ if not hasattr(socket, 'inet_pton'):
+ return # No inet_pton() on this platform
from socket import inet_aton as f, inet_pton, AF_INET
g = lambda a: inet_pton(AF_INET, a)
@@ -332,6 +334,8 @@ class GeneralModuleTests(unittest.TestCase):
self.assertEquals('\xaa\xaa\xaa\xaa', g('170.170.170.170'))
def testIPv6toString(self):
+ if not hasattr(socket, 'inet_pton'):
+ return # No inet_pton() on this platform
try:
from socket import inet_pton, AF_INET6, has_ipv6
if not has_ipv6:
@@ -349,6 +353,8 @@ class GeneralModuleTests(unittest.TestCase):
)
def testStringToIPv4(self):
+ if not hasattr(socket, 'inet_ntop'):
+ return # No inet_ntop() on this platform
from socket import inet_ntoa as f, inet_ntop, AF_INET
g = lambda a: inet_ntop(AF_INET, a)
@@ -362,6 +368,8 @@ class GeneralModuleTests(unittest.TestCase):
self.assertEquals('255.255.255.255', g('\xff\xff\xff\xff'))
def testStringToIPv6(self):
+ if not hasattr(socket, 'inet_ntop'):
+ return # No inet_ntop() on this platform
try:
from socket import inet_ntop, AF_INET6, has_ipv6
if not has_ipv6: