本文整理汇总了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))
示例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)
示例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))
示例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
示例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