[BangPypers] issues using constructor in unittest

Noufal Ibrahim noufal at gmail.com
Mon Mar 14 13:32:16 CET 2011


On Mon, Mar 14 2011, Senthil Kumaran wrote:


[...]

>> This whole XUnit style unit testing thing is not really necessary in
>> the Python world. 
>
> Why? It is very much part of python world. It is part of the stdlib,
> because it is so easy to use.

There are lots of libraries in the standard library that are not really
pythonic and which are mirrors of a corresponding C library.

> There are easier frameworks like py.test which do a lot of
> metaprogramming magic and make the testing fun, but that does not
> count of removing xUnit style test, which can imbibe in you pattern to
> think about tests.

It's probably just my personal preference but I'd like a few functions
like.

def test_foo():
        x = do_foo()
        assert x == "some true value"

in a file which I could just run rather than subclassing and doing all
that which Xunit demands. Python is about less boilerplate and more
simplicity isn't it? 

unittest2 is getting better but I think Xunit is a more a child of
Smalltalk and Java than Python. 

Options are always a good thing though and YMMV. 


-- 


More information about the BangPypers mailing list