[TIP] why do you use py.test?

Kumar McMillan kumar.mcmillan at gmail.com
Sat Feb 19 13:37:31 PST 2011


On Mon, Feb 14, 2011 at 7:12 PM, Herman Sheremetyev <herman at swebpage.com> 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, taking 0.60
> seconds to run the same set of tests it takes nose 0.062.

I haven't used py.test extensively but I've used Nose extensively and
I am often boggled at how slow Nose is to *start* running tests.  I
imagine this is due to its collection process and the large amount of
files in my project but I haven't been annoyed enough to try
optimizing this.  Unittest might also be the offender.

> So, what are your reasons for using py.test (or some other test runner) ? :)

The major advantage py.test has over Nose is that it was written from
the ground up as a test runner.  Nose OTOH is an extension of unittest
so there are things in Nose that are really hard to do because of
unittest's poor design, like doctoring up the error report output in a
plugin compatible way.  There are probably lots of other plugin ideas
that would be easier to implement in py.test due to its architecture.
Just a guess.

The multi-process support in py.test is more robust than in Nose.
This is important because many slow test suites gain significant
speedups by running in parallel and even across a cluster of machines.
 If you are aiming at very fast continuous deployment, py.test might
be a better tool.  Py.test has a few other features that work better
than in Nose, like loop on fail.

However, as Holger mentioned, I think py.test and Nose have converged
on most features now.


-Kumar


>
> -Herman
>
> P.S. I know people tend to get sensitive about their tools, so I don't
> want to start a flame war, just genuinely curious why people are using
> this particular one..
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>



More information about the testing-in-python mailing list