In the newly added test_server_finishes_on_error
test for testserver.Server
, I changed the pass
in the except
block to raise
, to temporarily cause the test to fail. The two files in this gist
show the difference in output between letting the select.error
/socket.error
from interrupting
_accept_connection
be raised vs. suppressed.
In socket_interruption_suppressed.txt
, it is clear where the test failed - at the exception in the test function.
In socket_interruption_raised.txt
,
there is extra output that distracts from the real failure. The test server is functioning as it should -
allowing the server thread to be interrupted and exit gracefully when the test code leaves the with
block - so the error output in this case is misleading. Nothing went wrong in the test server; it simply
exited before accepting the number of expected connections. If this is an error in the context of the
code under test, that must be expressed in the test code, so errors from the test server are irrelevant.
This is obviously a contrived example, but similar things happened as I was working on the tests for the ALL_PROXY support as they were failing.
That said, I don't feel terribly strong about this. If you still think this exception should be propagated outside the test server, I'll gladly change it to do so.