Nick Coghlan <ncogh...@gmail.com> added the comment:

As another data point, this question came up again in the context of issue 
#12958.

The new test_socket.ThreadableTest uses tearDown() to pick up and reraise any 
exception that occurred in the client thread. This meant that my initial 
attempts at flagging some expected failures (due to Mac OS X limitations) 
didn't work - the client half of the failure was thrown in tearDown() and 
reported as an error.

While I've determined how to avoid that problem in the test_socket case, the 
general question of whether or not we consider it legitimate to put common 
assertions in setUp() and tearDown(), or expect that test code explicitly cope 
with tearDown() failures that occur due to expected test failures still needs 
to be addressed.

To my mind, bugs in my test infrastructure are going to get flushed out by 
tests that I'm neither skipping nor marking as expected failures. If I have a 
test that is known to fail in a way that invalidates the standard tearDown 
procedure for the test infrastructure, having to special case that situation in 
the tearDown code seems to go against the spirit of offering the 
"expectedFailure" decorator in the first place.

I don't think the same reasoning holds for setUp though - there's no way for a 
failing test to reach back and force setUp to fail, so any errors raised there 
are always going to be infrastructure errors.

----------
nosy: +ncoghlan

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

Reply via email to