[TIP] parametrized testing and unittest2.TestCase

holger krekel holger at merlinux.eu
Sat Dec 17 12:37:02 PST 2011


On Fri, Dec 16, 2011 at 18:47 -0800, Hans Sebastian wrote:
> 2011/12/16 holger krekel <holger at merlinux.eu>
> > FWIW i am happy with using assert statements and not have to remember
> > the assert methods.  Do you see a particular shortcoming of using assert?
> >
> > No. What I have done in the past is to use assert statements but wrapping
> them in methods where they get logged when executed. Logging is what i care
> the most, useful for debugging for me. Currently I need to use unittest
> TestCase not only for the assert statements but also so the tests can be
> run without py.test as well. For this reason I realize that I cannot
> paramterize tests at all.

Maybe some day we can grow a unittest2 plugin that implements parametrized
testing.  Not sure if this is of interest but you can put a no-dependency
py.test script into your project to avoid depending on additional installations.
See http://pytest.org/latest/goodpractises.html#create-a-py-test-standalone-script

> For now I think will do without the parameterization until we can do
> without unittest.
> 
> In any case, thanks for the reply. Good weekends!
>
same!
holger



More information about the testing-in-python mailing list