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.

Author RubyTuesdayDONO
Recipients RubyTuesdayDONO
Date 2013-12-05.20:59:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1386277185.98.0.181450665143.issue19901@psf.upfronthosting.co.za>
In-reply-to
Content
When building Python 3.3.2-r2 from Gentoo's Portage tree [1], I encountered two failed tests which probably should not have been attempted on my OS (Gentoo 3.7.10): test_bind_port and test_find_unused_port both use the SO_REUSEPORT socket option which, to the best of my knowledge is only available since kernel version 3.9. I was able to build by skipping the tests — but I believe the tests are there for a reason, and it would be best if a test that is known to fail should be skipped (or replaced with a fallback that is likely to succeed). Issue # 16594 [3] may be related (not sure).

Is it possible to detect the kernel version and skip (or modify) these tests if SO_REUSEPORT is not available? Better yet (since even a 3.9 kernel could have it disabled) — try the test with SO_REUSEPORT, but trap the exception for lack of OS support, print a warning, and try again without SO_REUSEPORT. 

+=== excerpt of portage build log:
======================================================================
ERROR: test_bind_port (test.test_support.TestSupport)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.Lib/test/test_support.py", line 87, in test_bind_port
    support.bind_port(s)
  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.Lib/test/support.py", line 548, in bind_port
    if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
OSError: [Errno 92] Protocol not available

======================================================================
ERROR: test_find_unused_port (test.test_support.TestSupport)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.Lib/test/test_support.py", line 80, in test_find_unused_port
    port = support.find_unused_port()
  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.Lib/test/support.py", line 522, in find_unused_port
    port = bind_port(tempsock)
  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.Lib/test/support.py", line 548, in bind_port
    if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
OSError: [Errno 92] Protocol not available
===+

[1]: https://packages.gentoo.org/package/dev-lang/python
[2]: https://lwn.net/Articles/542629/
[3]: http://bugs.python.org/issue16594
History
Date User Action Args
2013-12-05 20:59:46RubyTuesdayDONOsetrecipients: + RubyTuesdayDONO
2013-12-05 20:59:45RubyTuesdayDONOsetmessageid: <1386277185.98.0.181450665143.issue19901@psf.upfronthosting.co.za>
2013-12-05 20:59:45RubyTuesdayDONOlinkissue19901 messages
2013-12-05 20:59:45RubyTuesdayDONOcreate