Jean-Paul Calderone <exar...@twistedmatrix.com> added the comment:

> You mean that socket.create_connection(), httplib (issue 3972) and ftplib 
> (issue 8594) should have used a different API to implement their 
> "source_address" option?

I'm not sure what you mean.  The problem here is that you cannot reliably bind 
a specific local address because it might be bound already.

This is bad in unit tests because it causes spurious failures that waste 
developer effort forcing people to investigate non-bugs or because it causes 
people to ignore the results of the test suite.

This is bad in real applications because it prevents an application from 
working as it is supposed to.

Perhaps you have an application which requires that HTTP requests are issued 
from (1.2.3.4, 12345).  Then you'd better use an HTTP client library that lets 
you bind to this address when connecting to the HTTP server.  But the 
application is going to be prone to failure.  If you can't get around the 
requirement, then you just get to live with an unreliable application.

There's no such requirement in any unit test, though.  Unit tests can do 
whatever they want in order to achieve the goal of exercising the relevant 
implementation code and verify the results to be correct.  I don't think there 
are any unit tests which need to bind to one specific address in order to 
accomplish this goal.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8576>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to