Skip to content

Commit

Permalink
Restore test_socket IDNATest with working domain name (jython#260)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
jeff5 authored Jul 9, 2023
1 parent 47812da commit c0a5d43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 7 additions & 4 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from test import test_support

import errno
import gc
import jarray
import Queue
import platform
import pprint
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,6 @@ The text for an official release would continue like ...
<arg value="test_py_compile"/> <!-- test_relative_path (on osx) -->
<arg value="test_select_new"/>
<arg value="test_smtpnet"/>
<arg value="test_socket"/>
</exec>
</target>

Expand All @@ -1532,7 +1531,6 @@ The text for an official release would continue like ...
<arg value="test_os_jy"/> <!-- locale command (on git bash) -->
<arg value="test_select_new"/>
<arg value="test_smtpnet"/>
<arg value="test_socket"/>
</exec>
</target>

Expand Down

0 comments on commit c0a5d43

Please sign in to comment.