From c0a5d43f325b0e27189bd7e7aea778a03665ff31 Mon Sep 17 00:00:00 2001 From: Jeff Allen Date: Sun, 9 Jul 2023 13:10:47 +0100 Subject: [PATCH] Restore test_socket IDNATest with working domain name (#260) The test failed previously because the site used in the test did not exist and testGetAddrInfoIDNAHostname must resolve it in DNS. We find another site that will hopefully exist for a while. The change re-enables `test_socket` in CI, but with skips on posix for still-failing tests (not related to IDN). --- Lib/test/test_socket.py | 11 +++++++---- build.xml | 2 -- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index c629132f6..14d707ef8 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -4,8 +4,6 @@ from test import test_support import errno -import gc -import jarray import Queue import platform import pprint @@ -884,6 +882,8 @@ def _testInheritedOption(self, level, option, values): except Exception, x: self.fail("Inherited option should not have raised exception: %s" % str(x)) +@unittest.skipIf(test_support.is_jython_posix, + "Failing, possible race during close()-open().") class TestSupportedOptions(TestSocketOptions): def testSO_BROADCAST(self): @@ -2397,8 +2397,11 @@ def _testUnicodeHostname(self): class IDNATest(unittest.TestCase): + # This site must exist in DNS as an IDN, hopefully with a long future. + DOMAIN = u'\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430.\u0443\u043a\u0440' + def testGetAddrInfoIDNAHostname(self): - idna_domain = u"al\u00e1n.com" + idna_domain = IDNATest.DOMAIN if socket.supports('idna'): try: addresses = socket.getaddrinfo(idna_domain, 80) @@ -2416,7 +2419,7 @@ def testGetAddrInfoIDNAHostname(self): self.fail("Non ascii domain '%s' should have raised UnicodeEncodeError: no exception raised" % repr(idna_domain)) def testAddrTupleIDNAHostname(self): - idna_domain = u"al\u00e1n.com" + idna_domain = IDNATest.DOMAIN s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if socket.supports('idna'): try: diff --git a/build.xml b/build.xml index 93e09a356..4bd943731 100644 --- a/build.xml +++ b/build.xml @@ -1511,7 +1511,6 @@ The text for an official release would continue like ... - @@ -1532,7 +1531,6 @@ The text for an official release would continue like ... -