Re: unittest: Calling tests in liner number order



On May 24, 10:12 am, Roy Smith <r...@xxxxxxxxx> wrote:
In article
<84ff733a-e364-437d-9b5d-d8bb14cc6...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
John Roth <johnro...@xxxxxxxxx> wrote:

Does the following patch has a chance of being introduced in the
standard python distribution?

I certainly hope not!

I think you're being overly negative here. Antoon went to the trouble to
read the sources and post a diff. At the very least, he deserves a more
polite response.

But, more than that, I think Antoon's idea has some merit. I understand
that the mantra in unit testing is that the tests should be able to be run
in any order. Still, it's the job of a library package to make it easy to
do things, not to enforce policy. If somebody (for whatever reason) has a
need to run their tests in a certain order, why is it our job to make it
hard for them to do that?

In fact, unittest.defaultTestLoader *already* sorts the tests into
alphabetical order by their name. So, if somebody wanted to get the tests
run in order, they could just name their tests "test0001", "test0002", etc..
In fact, I've done that in the past when I had some (long forgotten) reason
why I wanted to run a bunch of things in order. Allowing the tests to be
sorted by line number order instead of by name just makes it a little
easier to do the same thing.

If somebody wants that functionality, and is willing to put in the effort
to write the code to do it, and contribute that back to the community, I
don't see any reason why it shouldn't be considered. It would have to be
done in a way that doesn't change the current behavior (perhaps by shipping
a subclass of TestLoader which users could use instead of the default).
I'm not saying that we *need* to include it, just that it's not such a bad
idea that it deserves responses like "I certainly hope not!"

I totally agree.

I can't relate to anyone that want to oppose a change that would give
more freedom to a programmer.

André
.



Relevant Pages

  • Re: unittest: Calling tests in liner number order
    ... Antoon went to the trouble to ... polite response. ... I've done that in the past when I had some reason ... idea that it deserves responses like "I certainly hope not!" ...
    (comp.lang.python)
  • Re: an old problem with pdfdraftcopy.sty
    ... $ diff COMMITTED-pdfdraftcopy.sty pdfdraftcopy.sty 21c21 ... I see absolutely no reason why updating the CVS/RCS string should cause ...
    (comp.text.tex)
  • Re: form equation takes at large value of time
    ... But I suggest to be careful with such arguments, one reason being ... the "phenomena" of instability in certain diff. ... this trivial solution ... ...
    (sci.math)
  • Re: NBC Question for Angela and Laurie
    ... But there's a HUGE diff, because of the mother-child connection (that for ... but I think that's part of the reason BT has ... What's the difference between Vietnam & Iraq? ...
    (rec.music.artists.springsteen)
  • Re: Upload File
    ... Thats the reason you can ... see the jpg file, as its been modified. ... You can observe this diff, ...
    (microsoft.public.dotnet.languages.csharp)