[TIP] why do you use py.test?

Phlip phlip2005 at gmail.com
Mon Feb 14 20:19:08 PST 2011


Herman Sheremetyev wrote:

> I've seen a lot of messages on this list of people mentioning they use
> py.test, so I'm curious what advantages it offers. I gave it a try and
> immediately noticed it was literally 10x slower than nose

I have not auditioned nose yet or figured out what was its point.

I use the assert handler in test.py. Given...

  assert x == 42

...the diagnostic will reflect the entire expression and all its
intermediate values. (Like my assert{ 2.0 }, and Wrong, for Ruby.}

That means I can do away with self.assertEqual() and all its ilk. I
can make an assertion out of any kind of statement, without worrying
its diagnostic will be unreadable.

All assertions should do this, and all languages should support it.



More information about the testing-in-python mailing list