'Right now, halfway by accident, trial sorts like this:
1. all modules are grouped together in one list and sorted.
2. within each module, the classes are grouped together in one list
and sorted.
3. finally within each class, each test method is grouped together
in a list and sorted.
This attempts to return a sorted list of testable thingies following
those rules, so that we can compare the behavior of loadPackage.
The things that show as \'cases\' are errors from modules which failed to
import, and test methods.  Let\'s gather all those together.'

def _trialSortAlgorithm(self, sorter):

    pkg = getModule('uberpackage')
    testModules = []
    for testModule in pkg.walkModules():
        if testModule.name.split('.')[(-1)].startswith('test_'):
            testModules.append(testModule)
    sortedModules = sorted(testModules, key=sorter)
    for modinfo in sortedModules:
        module = modinfo.load(None)
        if (module is None):
            (yield modinfo)
        else:
            testClasses = []
            for attrib in modinfo.iterAttributes():
                if runner.isTestCase(attrib.load()):
                    testClasses.append(attrib)
            sortedClasses = sorted(testClasses, key=sorter)
            for clsinfo in sortedClasses:
                testMethods = []
                for attr in clsinfo.iterAttributes():
                    if attr.name.split('.')[(-1)].startswith('test'):
                        testMethods.append(attr)
                sortedMethods = sorted(testMethods, key=sorter)
                for methinfo in sortedMethods:
                    (yield methinfo)
