learning unit testing in python
i.i at i.i
Mon Jun 23 21:26:25 CEST 2008
> Hi all.
> I'd like learn some basic unit testing with python.
> I red some articles about different testing framework like unittest or
> nose, but I'm a bit confused: what is the best choice? I'm not a
> professional developer (I'm a SEO) but I belive that unit testing is a
> good and pragmatic way to produce working software, so I'd like to
> find something really simple ad straightforward because I don't have
> to manage big programming projects.
> Thanks in advance,
Have you checked out doctest?
It's the best way to add few tests to function or class, you just add
them to docstring.
Unit tests are somewhat demanding as they usualy require creating another
file just for storing them, but are ofcourse more powerful as well. For
unittest module alows you to execute a section of code before or after each
to initialize values and clean up.
Nose module has few extra features, but it can also run test writen for
so it's easy to switch if you find standard library module lacking for your
More information about the Python-list