unit testing

Giampaolo Rodolà gnewsg at gmail.com
Fri Oct 5 16:31:33 EDT 2007


On 3 Ott, 14:37, Bruno Desthuilliers
<bdesth.quelquech... at free.quelquepart.fr> wrote:
> Paul Rubin a écrit :
>
> > brad <byte8b... at gmail.com> writes:
>
> >>Does anyone else feel that unittesting is too much work? Not in
> >>general, just the official unittest module for small to medium sized
> >>projects?
>
> > Yeah, unittest is sort of a Java-ism.  You might try the newer doctest
> > module instead.
>
> Or py.test or nose, which are both more complete than doctest and more
> pythonics than the unittest module.

Very interesting, thank you.
This is the first time I heard about py.test so I took a look at what
it is:
http://codespeak.net/py/dist/test.html
http://ianbicking.org/docs/pytest-presentation/pytest-slides.html

At a first look it seems very comfortable to me but I noticed that all
usage examples shown uses nothing but the assert statement:

def test_answer():
    assert 42 == 43

What's the equivalent of unittest's "assertRaises"?
In certain situations it is also useful to test wether an exception
(along its type) is raised or not.
Does py.test support such thing?




More information about the Python-list mailing list