[TIP] alphabetical order in testing

holger krekel holger at merlinux.eu
Wed Jan 20 12:22:33 PST 2010

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. 

> For all that many posters have claimed that order of tests should not  
> matter, it does -- even for unit tests.  You can _intend_ to implement  
> your tests so that it does not matter which order they execute in, but  
> what if you make a mistake and create a side-effect that influences the  
> outcome of a later test?  In that case, it is useful to have a fixed  
> order to make it easier to debug your tests.

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



More information about the testing-in-python mailing list