当前位置: 首页>>代码示例>>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;未经允许,请勿转载。