[TIP] Determine test status in tearDown method

holger krekel holger at merlinux.eu
Wed Oct 21 06:55:25 PDT 2009

On Wed, Oct 21, 2009 at 08:06 -0500, Olemis Lang wrote:
> ... 
> The only thing I can mention so far is that once upon a time I had the
> need to keep track of some conditions that were not precisely errors,
> but didn't look like total success either (just like a fuzzy measure
> of test success, more or less ;o) . I was benchmarking the support
> provided by some DBC implementations for Py and sometimes I wanted to
> have a result like e.g. «it is consistent with contracts semantics but
> doesn't support custom messages to describe the failure». What I did
> was to add support for warnings in instances of test cases. Following
> that model anybody can keep track of such warnings by issuing a call
> just like `tc.warn(msg, ...)` , and you could do it anywhere, even
> inside `tearDown` method.

I like the idea of systematically allowing test code to signal warnings. 
It is then a matter of reporting how/when to present it.  


More information about the testing-in-python mailing list