Skip Montanaro <skip@pobox.com> writes: > Andreas> Have you been trying to put the database creation into the > Andreas> setUp() method that is executed before every testcase ? > > No, I was just trying to mimic the structure of the test_xmlrpc.py module. > It put all the cases into one class, so I did to. I realized I wanted to > run the creation test before the others and noticed that it was executing > them in alphabetical order. I was just wondering if I could rely on that or > if that was just a quirk of either the current test_support or unittest > implementations and couldn't be relied on. Well, there's this: def getTestCaseNames(self, testCaseClass): """Return a sorted sequence of method names found within testCaseClass """ testFnNames = filter(lambda n,p=self.testMethodPrefix: n[:len(p)] == p, dir(testCaseClass)) for baseclass in testCaseClass.__bases__: for testFnName in self.getTestCaseNames(baseclass): if testFnName not in testFnNames: # handle overridden methods testFnNames.append(testFnName) if self.sortTestMethodsUsing: testFnNames.sort(self.sortTestMethodsUsing) return testFnNames in unittest.py & self.sortTestMethodsUsing seems to be cmp() by default. Don't know if this is documented or subject to change, though. It seems you could define a subclass of TestLoader, override getTestCaseNames and pass an instance as the testLoader arg to unitest.main() if you want to be sure. Cheers, M. -- ARTHUR: Why should he want to know where his towel is? FORD: Everybody should know where his towel is. ARTHUR: I think your head's come undone. -- The Hitch-Hikers Guide to the Galaxy, Episode 7
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4