unittest vs py.test?

Peter Hansen peter at engcorp.com
Sat Apr 2 10:24:09 EST 2005


Roy Smith wrote:
> Actually, I believe it does.  I'm just starting to play with this, but it 
> looks like you can do:
> 
> py.test test_sample.py
> 
> and it'll run a single test file.  

Well, my driver script can do that too.  I just meant
I could do "test_sample.py" and have it run the test
any time, if I wanted, and I was mainly trying to
show that even the __name__ == '__main__' part of
my example was not essential to the use of unittest.
Comparing apples to apples, so to speak, since it
looks like you don't use an import to get access
to py.test.

As near as I can tell, other than requiring an import
statement, and a class statement, there is zero
additional overhead with unittest versus py.test,
given the way I want to structure my tests (in
functions or methods).  Is that true?  If so, I stand
by my claim that the difference in "weight" between
the two is much much less than some have claimed.

-Peter



More information about the Python-list mailing list