[Python-ideas] unittest and warnings
Masklinn
masklinn at masklinn.net
Mon Jun 17 08:22:09 CEST 2013
On 2013-06-17, at 02:32 , Giampaolo Rodola' wrote:
> One of the features I like the most in the new unittest2 module is the
> possibility to skip tests and how they are included in the final result
> (e.g. FAILED (errors=2, failures=3, *skipped=5*)).
> After http://bugs.python.org/issue10093 it is not rare that different
> ResourceWarnings appear while running tests.
> Personally I consider these warnings as something which needs to be fixed
> so after I run tests I often scroll my console window back up to see
> whether there were warnings.
> Would it make sense for unittest module to keep track of them so that they
> get included in the final test result as it currently happens for skipped
> tests?
>
> Side note: unittest provides some "skip-related" APIs such unittest.skip*,
> TestResult.skipped and others but I don't think something similar would be
> necessary except maybe a TestResult.warnings list similar to
> TestResult.skipped.
Why not just use -Werror?
Alternatively, capture warnings[0] and report them as whatever you wish
to your test system.
[0] http://docs.python.org/2/library/warnings.html#warnings.catch_warnings
More information about the Python-ideas
mailing list