當前位置: 首頁>>代碼示例>>Python>>正文


Python core.run方法代碼示例

本文整理匯總了Python中nose.core.run方法的典型用法代碼示例。如果您正苦於以下問題:Python core.run方法的具體用法?Python core.run怎麽用?Python core.run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nose.core的用法示例。


在下文中一共展示了core.run方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from nose import core [as 別名]
# 或者: from nose.core import run [as 別名]
def run():
    argv = sys.argv
    stream = sys.stdout
    verbosity = 3
    testdir = os.path.dirname(os.path.abspath(__file__))

    conf = config.Config(stream=stream,
                         env=os.environ,
                         verbosity=verbosity,
                         workingDir=testdir,
                         plugins=core.DefaultPluginManager())
    conf.plugins.addPlugin(SlowTestsPlugin())
    conf.plugins.addPlugin(StressTestsPlugin())

    runner = GlusterNagiosTestRunner(stream=conf.stream,
                                     verbosity=conf.verbosity,
                                     config=conf)

    sys.exit(not core.run(config=conf, testRunner=runner, argv=argv)) 
開發者ID:gluster,項目名稱:gluster-nagios-common,代碼行數:21,代碼來源:testrunner.py

示例2: run_tests

# 需要導入模塊: from nose import core [as 別名]
# 或者: from nose.core import run [as 別名]
def run_tests(c=None):
    logger = logging.getLogger()
    hdlr = logging.StreamHandler()
    formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
    hdlr.setFormatter(formatter)
    logger.addHandler(hdlr)
    logger.setLevel(logging.DEBUG)

    # NOTE(bgh): I'm not entirely sure why but nose gets confused here when
    # calling run_tests from a plugin directory run_tests.py (instead of the
    # main run_tests.py).  It will call run_tests with no arguments and the
    # testing of run_tests will fail (though the plugin tests will pass).  For
    # now we just return True to let the run_tests test pass.
    if not c:
        return True

    runner = RyuTestRunner(stream=c.stream,
                           verbosity=c.verbosity,
                           config=c)
    return not core.run(config=c, testRunner=runner) 
開發者ID:lagopus,項目名稱:ryu-lagopus-ext,代碼行數:22,代碼來源:test_lib.py

示例3: run

# 需要導入模塊: from nose import core [as 別名]
# 或者: from nose.core import run [as 別名]
def run():
    argv = sys.argv
    stream = sys.stdout
    verbosity = 3
    testdir = os.path.dirname(os.path.abspath(__file__))

    conf = config.Config(stream=stream,
                         env=os.environ,
                         verbosity=verbosity,
                         workingDir=testdir,
                         plugins=core.DefaultPluginManager())
    conf.plugins.addPlugin(SlowTestsPlugin())
    conf.plugins.addPlugin(StressTestsPlugin())

    runner = PluginsTestRunner(stream=conf.stream,
                               verbosity=conf.verbosity,
                               config=conf)

    sys.exit(not core.run(config=conf, testRunner=runner, argv=argv)) 
開發者ID:gluster,項目名稱:nagios-plugins-gluster,代碼行數:21,代碼來源:testrunner.py

示例4: main

# 需要導入模塊: from nose import core [as 別名]
# 或者: from nose.core import run [as 別名]
def main(whitelist=[]):
    description = ("Runs boto unit and/or integration tests. "
                   "Arguments will be passed on to nosetests. "
                   "See nosetests --help for more information.")
    parser = argparse.ArgumentParser(description=description)
    parser.add_argument('-t', '--service-tests', action="append", default=[],
                        help="Run tests for a given service.  This will "
                        "run any test tagged with the specified value, "
                        "e.g -t s3 -t ec2")
    known_args, remaining_args = parser.parse_known_args()
    attribute_args = []
    for service_attribute in known_args.service_tests:
        attribute_args.extend(['-a', '!notdefault,' + service_attribute])
    if not attribute_args:
        # If the user did not specify any filtering criteria, we at least
        # will filter out any test tagged 'notdefault'.
        attribute_args = ['-a', '!notdefault']

    # Set default tests used by e.g. tox. For Py2 this means all unit
    # tests, while for Py3 it's just whitelisted ones.
    if 'default' in remaining_args:
        # Run from the base project directory
        os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

        for i, arg in enumerate(remaining_args):
            if arg == 'default':
                if sys.version_info[0] == 3:
                    del remaining_args[i]
                    remaining_args += PY3_WHITELIST
                else:
                    remaining_args[i] = 'tests/unit'

    all_args = [__file__] + attribute_args + remaining_args
    print("nose command:", ' '.join(all_args))
    if run(argv=all_args):
        # run will return True is all the tests pass.  We want
        # this to equal a 0 rc
        return 0
    else:
        return 1 
開發者ID:aristotle-tek,項目名稱:cuny-bdif,代碼行數:42,代碼來源:test.py

示例5: main

# 需要導入模塊: from nose import core [as 別名]
# 或者: from nose.core import run [as 別名]
def main():
    description = ("Runs footmark unit and/or integration tests. "
                   "Arguments will be passed on to nosetests. "
                   "See nosetests --help for more information.")
    parser = argparse.ArgumentParser(description=description)
    parser.add_argument('-t', '--service-tests', action="append", default=[],
                        help="Run tests for a given service.  This will "
                             "run any test tagged with the specified value, "
                             "e.g -t test_instance_attribute -t test_manage_instances")
    known_args, remaining_args = parser.parse_known_args()
    attribute_args = []
    for service_attribute in known_args.service_tests:
        attribute_args.extend(['-a', '!notdefault,' + service_attribute])
    if not attribute_args:
        # If the user did not specify any filtering criteria, we at least
        # will filter out any test tagged 'notdefault'.
        attribute_args = ['-a', '!notdefault']

    # Set default tests used by e.g. tox. For Py2 this means all unit
    # tests, while for Py3 it's just whitelisted ones.
    if 'default' in remaining_args:
        # Run from the base project directory
        os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

        for i, arg in enumerate(remaining_args):
            if arg == 'default':
                remaining_args[i] = 'tests/unit'

    all_args = [__file__] + attribute_args + remaining_args
    if run(argv=all_args):
        # run will return True is all the tests pass.  We want
        # this to equal a 0 rc
        return 0
    else:
        return 1 
開發者ID:alibaba,項目名稱:footmark,代碼行數:37,代碼來源:test.py


注:本文中的nose.core.run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。