class SortableSuite(unittest.TestSuite):

    def sort(self):
        self._tests.sort(cmp=lambda x, y: x._testMethodName < y._testMethodName
            )

def run(self, testResult):
    self._tests.sort(cmp=lambda x, y: x._testMethodName < y._testMethodName)
return unittest.TestSuite.run(self, testResult)
loader = unittest.TestLoader()
loader.suiteClass = SortableSuite
suite = loader.loadTestFromTestCases(collectedTests)
suite.sort()
suite.run(defaultTestResult())
Как сортировать тесты python unittest?