if __name__ == '__main__':
    loader = unittest.TestLoader()
ln = lambda f: getattr(MyTestCase, f).__func__.__code__.co_firstlineno
lncmp = lambda a, b: cmp(ln(a), ln(b))
loader.sortTestMethodsUsing = lncmp
unittest.main(testLoader=loader, verbosity=2)
изменение порядка модульных тестов в Python