⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 run_tests.py

📁 Harvestman-最新版本
💻 PY
字号:
# -- coding: utf-8""" Unit test wrapper moduleCreated: Anand B Pillai <abpillai@gmail.com> Jun 02 2008Copyright (C) 2008, Anand B Pillai."""import unittestimport test_baseimport globimport os, sys# FIXME: Add a unit-test log for failures with complete tracebacksdef run_all_tests():    """ Run all unit tests in this folder """    test_base.setUp()    # Get location of this module    curdir = os.path.abspath(os.path.dirname(test_base.__file__))    sys.path.append(curdir)    # Comment following line and uncomment line after it before checking in code...    # test_modules = glob.glob(os.path.join(curdir, 'test_[!base|connector]*.py'))    test_modules = glob.glob(os.path.join(curdir, 'test_[!base]*.py'))        result = unittest.TestResult()    for module in test_modules:        try:            print 'Running unit-test for %s...' % module            modpath, modfile = os.path.split(module)            m = __import__(modfile.replace('.py',''))            m.run(result)        except ImportError,e :            raise            pass            test_base.clean_up()    return resultdef run_test_connector():    import test_connector    print 'Running test_connector...'    suite = unittest.makeSuite(test_connector.TestHarvestManUrlConnector)    result = unittest.TestResult()    suite.run(result)    test_base.clean_up()        return resultdef run_test_urlparser():    import test_urlparser    print 'Running test_urlparser...'    suite = unittest.makeSuite(test_urlparser.TestHarvestManUrl)    result = unittest.TestResult()    suite.run(result)    test_base.clean_up()        return resultdef run_test_logger():    import test_logger        print 'Running test_logger...'    suite = unittest.makeSuite(test_logger.TestHarvestManLogger)    result = unittest.TestResult()    suite.run(result)    test_base.clean_up()        return resultdef run_test_urltypes():    import test_urltypes        print 'Running test_urltypes...'    suite = unittest.makeSuite(test_urltypes.HarvestManUrlTypes)    result = unittest.TestResult()    suite.run(result)    test_base.clean_up()        return resultdef run_test_urlcollections():    import test_urlcollections        print 'Running test_urlcollections...'    suite = unittest.makeSuite(test_urlcollections.HarvestManUrlCollections)    result = unittest.TestResult()    suite.run(result)    test_base.clean_up()        return resultdef run_test_pageparser():    import test_pageparser        print 'Running test_pageparser...'    suite = unittest.makeSuite(test_pageparser.TestHarvestManPageParser)    result = unittest.TestResult()    suite.run(result)    test_base.clean_up()        return resultif __name__=="__main__":    print run_all_tests()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -