Issue 23761: test_socket fails on Mac OSX 10.9.5 (original) (raw)

On Mac OSX 10.9.5, test_socket fails when regression tests are run.

Specifically, the following fails:

FAIL: test_host_resolution (test.test_socket.GeneralModuleTests)

Traceback (most recent call last): File "/Users/carol/Development/cpython/Lib/test/test_socket.py", line 788, in test_host_resolution self.assertRaises(OSError, socket.gethostbyname, addr) AssertionError: OSError not raised by gethostbyname

The output from

./python.exe -m test -v test_socket > output-test-socket.txt

is attached.

There are always going to be tests that are skipped (ones that don't run on your platform).

Most of test_socket should run even if all you have is localhost networking. The 'network' resource is designed to control access to external networking resources, and there is at least one specific test in test_socket that is protected by the resource.

I always run the test suite using '-uall' myself, which enables all the resources except for the ones that take lots of memory or disk space. If you have built python from source/checkout, then you can run the test suite using:

./python.exe -m test -uall

For investigating this failure, you should change the beginning of test_host_resolution from:

for addr in ['0.1.1.~1', '1+.1.1.1', '::1q', '::1::2',
             '1:1:1:1:1:1:1:1:1']:
    self.assertRaises(OSError, socket.gethostbyname, addr)
    self.assertRaises(OSError, socket.gethostbyaddr, addr)

to:

for addr in ['0.1.1.~1', '1+.1.1.1', '::1q', '::1::2',
             '1:1:1:1:1:1:1:1:1']:
    for func in socket.gethostbyname, socket.gethostbyaddr:
        with self.subTest(addr=addr, func=func):
            self.assertRaises(OSError, func, addr)

and report the results.