[TIP] alphabetical order in testing

Mark Sienkiewicz sienkiew at stsci.edu
Wed Jan 20 14:09:31 PST 2010

holger krekel wrote:
> On Wed, Jan 20, 2010 at 12:43 -0500, Mark Sienkiewicz wrote:
>> Of course, it could be any other arbitrary order, but alphabetical is  
>> much easier to determine than "order that they appear in the file" after  
>> you import a module.
> Huh?  Ordering functions by their file position is straight forward in Python. 

In that case, there is some clever python feature that I don't know 
about.  How does it work?  Is it easier than
    import os
    l = dir(os)

> I agree that stable ordering is valuable for replicating test failures. 
> Both file-position and alphabetical orderings are stable.  

Yes.  There are good arguments in favor of each too.  There is also a 
good argument for the ability to choose a random order, as long as you 
can get exactly the same random order again when you want it.

Mark S.

More information about the testing-in-python mailing list