replacing __dict__ with an OrderedDict

Lie Ryan lie.1296 at
Fri Jan 6 06:43:00 EST 2012

On 01/06/2012 08:48 PM, Ulrich Eckhardt wrote:
> Hi!
> The topic explains pretty much what I'm trying to do under Python
> 2.7[1]. The reason for this is that I want dir(SomeType) to show the
> attributes in the order of their declaration. This in turn should
> hopefully make unittest execute my tests in the order of their
> declaration[2], so that the output becomes more readable and structured,
> just as my test code (hopefully) is.

IMO that's a futile effort, first, because as you already know, the test 
should not rely on the order. If you want the result to be printed in a 
certain order, that's a display issue, not testing order issue. I guess 
you would have better luck doing what you want by customizing the 
TestResult or TestRunner.

More information about the Python-list mailing list