This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test_socket fails on Mac OSX 10.9.5
Type: behavior Stage:
Components: macOS Versions: Python 3.5
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, r.david.murray, ronaldoussoren, willingc
Priority: normal Keywords:

Created on 2015-03-24 13:21 by willingc, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
output-test-socket.txt willingc, 2015-03-24 13:21
Messages (7)
msg239120 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2015-03-24 13:21
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/", 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.
msg239139 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-03-24 15:14
This is almost certain to be an OSX bug.  Do you want to investigate?
msg239140 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-03-24 15:17
I don't recall ever seeing that failure on OS X systems.  Can you patch the test to find out which address lookup is not failing as expected and then check your host configuration?
msg239143 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-03-24 15:28
We could/should change that test to use subtests.
msg239188 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2015-03-24 22:03
Thanks Ned and R. David. A few questions...

1.  I've rerun the tests using:

One failure:
70 tests OK.
1 test failed:
1 test altered the execution environment:
21 tests skipped:
    test_curses test_dbm_gnu test_devpoll test_epoll test_gdb
    test_lzma test_msilib test_ossaudiodev test_smtpnet
    test_socketserver test_spwd test_startfile test_timeout test_tk
    test_ttk_guionly test_urllib2net test_urllibnet test_winreg
    test_winsound test_xmlrpc_net test_zipfile64

I noticed that many tests are skipped since Network is not enabled. Although test_socket fails and is not skipped, it seems plausible that the failure in test_socket should also be skipped when Network is disabled. Other test files that are skipped have support.requires('network') in the beginning of the file. Should have this as well?

2. I am rerunning the tests with the following command:
./python.exe -m test -uall

Tests dependent on 'Network' are now run. Three failures now:

3 tests failed:
    test_curses test_nntplib test_socket
1 test altered the execution environment:
14 tests skipped:
    test_dbm_gnu test_devpoll test_epoll test_gdb test_lzma
    test_msilib test_ossaudiodev test_spwd test_startfile test_tk
    test_ttk_guionly test_winreg test_winsound test_zipfile64

    nntplib.NNTPTemporaryError: 400 Permission denied:  Closed service.

3. Is there a doc that outlines how to enable all dependencies needed to have tests execute and not be skipped? Which is the preferred command for running tests for Mac OSX?

I'm willing to keep chasing this down but need a little direction. Thanks.
msg239198 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-03-25 00:26
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',
        self.assertRaises(OSError, socket.gethostbyname, addr)
        self.assertRaises(OSError, socket.gethostbyaddr, addr)


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

and report the results.
msg240576 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2015-04-13 00:52
Tests for current CPython version now pass on Mac OSX  10.9.5. Closing issue.
Date User Action Args
2022-04-11 14:58:14adminsetgithub: 67949
2015-04-13 00:52:10willingcsetstatus: open -> closed
resolution: not a bug
messages: + msg240576
2015-03-25 00:26:08r.david.murraysetmessages: + msg239198
2015-03-24 22:03:16willingcsetmessages: + msg239188
2015-03-24 15:28:45r.david.murraysetmessages: + msg239143
2015-03-24 15:17:57ned.deilysetmessages: + msg239140
2015-03-24 15:14:41r.david.murraysetnosy: + ronaldoussoren, r.david.murray, ned.deily
messages: + msg239139
components: + macOS, - Tests
2015-03-24 13:21:41willingccreate