I personally don't see any benefit in this approach. By definition, unittests should be independent, so the order argument suggests a deeper issue. What's your use case ?
Quentin On Fri, May 23, 2008 at 11:36 AM, Antoon Pardon <[EMAIL PROTECTED]> wrote: > Some time ago I asked whether is would be possible that unittest would > perform the test in order of appearence in the file. > > The answers seemed to be negative. Since I really would like this > behaviour I took the trouble of looking throught the source and > I think I found a minor way to get this behaviour. > > Now my questions are: > > Are other people interrested in this behaviour? > Does the following patch has a chance of being introduced in the > standard python distribution? > > *** /usr/lib/python2.5/unittest.py 2008-04-17 16:26:37.000000000 +0200 > --- unittest.py 2008-05-23 11:19:57.000000000 +0200 > *************** > *** 570,575 **** > --- 570,577 ---- > """ > def isTestMethod(attrname, testCaseClass=testCaseClass, > prefix=self.testMethodPrefix): > return attrname.startswith(prefix) and > callable(getattr(testCaseClass, attrname)) > + def getlinenr(name): > + return getattr(testCaseClass, > name).im_func.func_code.co_firstlineno > testFnNames = filter(isTestMethod, dir(testCaseClass)) > for baseclass in testCaseClass.__bases__: > for testFnName in self.getTestCaseNames(baseclass): > *************** > *** 577,582 **** > --- 579,586 ---- > testFnNames.append(testFnName) > if self.sortTestMethodsUsing: > testFnNames.sort(self.sortTestMethodsUsing) > + else: > + testFnNames.sort(key=getlinenr) > return testFnNames > > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list