[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

Trent Nelson report at bugs.python.org
Mon May 3 10:26:42 CEST 2010


Trent Nelson <tnelson at onresolve.com> added the comment:

I introduced test_support.find_unused_port in r62234, as part of a general refactoring of client/server network-oriented tests.  The only reason I introduced this method at the time was because the SSL tests used to launch openssl in server mode, which required a port to be specified as part of the command line.

Pure Python tests shouldn't use this method, as noted in the docstring, they should use bind_port(), which takes platform socket-oddities into account.

I'm not sure if I agree that find_unused_port() should be removed though; it does serve a purpose in very rare corner cases.  Perhaps it should be renamed to _find_unused_port() to discourage accidental usage.

(I'd recommend reviewing r62234's commit log and change set for more info.)

----------
nosy: +trent

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8576>
_______________________________________


More information about the Python-bugs-list mailing list