summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-08-18 19:45:33 -0700
committerBob Halley <halley@dnspython.org>2020-08-18 19:45:33 -0700
commit04d65197c72930fbc2857e7384418d6f045f7aa0 (patch)
tree1fcb7b118b780060d0c3df7cd6b693f219d88f6b
parent98d8b13fe3efef91e690a789817ad0006df4f70a (diff)
downloaddnspython-04d65197c72930fbc2857e7384418d6f045f7aa0.tar.gz
On win32, skip valid IPv6 addresses that socket.inet_pton() erroneously thinks are invalid.
-rw-r--r--tests/test_address.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/test_address.py b/tests/test_address.py
index 98150f2..1ee7022 100644
--- a/tests/test_address.py
+++ b/tests/test_address.py
@@ -248,13 +248,20 @@ class IPv6Tests(unittest.TestCase):
"::0:a:b:c:d:e:f",
"a:b:c:d:e:f:0::",
)
- if sys.platform == 'win32':
- for s in valid:
- try:
- socket.inet_pton(socket.AF_INET6, s)
- except Exception:
- print('win32 rejects:', s)
+
+ win32_invalid = {
+ "::2:3:4:5:6:7:8",
+ "::2222:3333:4444:5555:6666:7777:8888",
+ "::2222:3333:4444:5555:6666:123.123.123.123",
+ "::0:0:0:0:0:0:0",
+ "::0:a:b:c:d:e:f",
+ }
+
for s in valid:
+ if sys.platform == 'win32' and s in win32_invalid:
+ # socket.inet_pton() on win32 rejects some valid (as
+ # far as we can tell) IPv6 addresses. Skip them.
+ continue
self.assertEqual(dns.ipv6.inet_aton(s),
socket.inet_pton(socket.AF_INET6, s))