[issue7897] Support parametrized tests in unittest

Fernando Perez report at bugs.python.org
Fri Feb 12 00:48:45 CET 2010


Fernando Perez <fdo.perez at gmail.com> added the comment:

I should probably have clarified better our reasons for using this type of code.  The first is the one Michael pointed out, where such parametric tests all execute; it's very common in scientific computing to have algorithms that only fail for certain values, so it's important to identify these points of failure easily while still running the entire test suite.  

The second is that the approach nose uses produces on failure the nose stack, not the stack of the test. Nose consumes the test generators at test discovery time, and then simply calls the stored assertions at test execution time.  If a test fails, you see a nose traceback which is effectively useless for debugging and with which using --pdb for interactive debugging doesn't help much (all you can do is print the values, as your own stack is gone).  This code, in contrast, evaluates the full test at execution time, so a failure can be inspected 'live'.  In practice this makes an enormous difference in a test suite being actively useful for ongoing development where changes may send you into debugging often.

I hope this helps clarify the intent of the code better, I'd be happy to provide further details.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7897>
_______________________________________


More information about the Python-bugs-list mailing list