示例#1
0
    if testcase:
        mod, case = testcase.rsplit('.', 1)
        mod = loader.import_module(mod)
        if not mod or not hasattr(mod, case):
            sys.stdout.write("Load case error: %s\n" % testcase)
            sys.exit(1)

        testcase = getattr(mod, case)
        suite = defaultTestLoader.loadTestsFromTestCase(testcase)
    else:
        cases = loader.register(submodule='tests')
        suites = [defaultTestLoader.loadTestsFromModule(mod) for mod in cases]
        suite = defaultTestLoader.suiteClass(suites)

    TextTestRunner().run(suite)


ARGV = []

if __name__ == '__main__':
    argv = sys.argv[1:]
    if argv and argv[0] == 'alembic':
        ARGV = filter(lambda a: not a in ('-c', 'alembic') and not a.startswith('base.config.'), argv)
        argv = filter(lambda a: not a in ARGV, argv)
        sys.argv = [sys.argv[0] + ' alembic'] + argv

    manager.run()


# pymode:lint_ignore=F0401,W801,W0603