本文整理汇总了Python中sandbox.Sandbox.get_component_path方法的典型用法代码示例。如果您正苦于以下问题:Python Sandbox.get_component_path方法的具体用法?Python Sandbox.get_component_path怎么用?Python Sandbox.get_component_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sandbox.Sandbox
的用法示例。
在下文中一共展示了Sandbox.get_component_path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from sandbox import Sandbox [as 别名]
# 或者: from sandbox.Sandbox import get_component_path [as 别名]
#.........这里部分代码省略.........
# If we're collecting tests, it's virtually guaranteed that we want to
# display the list...
if '--collect-only' in argv:
if '-v' not in argv and '--verbose' not in argv:
verbosity_found = False
for a in argv:
if a.startswith('--verbosity'):
verbosity_found = True
break
if not verbosity_found:
argv.append('--verbose')
# The "full" flag tells us to test all components in the sandbox,
# instead of just the ones that are present in code form. If our scope
# is full, no special effort is required. However, if our scope is
# normal (quick), we have to tell nose which subdirs to use during
# discovery.
if not SPECIFIC_TESTS_SELECTED:
global quick
if '--full' in argv:
argv.remove('--full')
quick = False
if '--quick' in argv:
quick = True
argv.remove('--quick')
if quick:
subset = []
cr = sb.get_code_root()
tr = sb.get_test_root()
deps = [l.name for l in sb.get_cached_components()]
for c in deps:
if component.CODE_ASPECT_NAME in sb.get_component_aspects(c) or c == sb.get_top_component():
component_test_root = sb.get_component_path(c, component.TEST_ASPECT_NAME)
if os.path.isdir(component_test_root):
if could_have_tests(component_test_root):
# Nose treats the first --where arg as a specifier
# of the working directory, and subsequent --where
# args as folders to use for discovery. So if we're
# going to add --where, we have to guarantee working
# dir is the first --where.
if not subset:
argv.append('--where')
argv.append(sb.get_root())
argv.append('--where')
argv.append(component_test_root)
subset.append(c)
if subset:
print('Targeting: ' + ', '.join(subset) + ' (--full to override).')
# The default behavior of the "sb test" command is supposed to be that
# all tests get run, no matter what part of the sandbox you're in when
# you invoke the command. This is consistent with "sb build", "sb publish",
# and other sandbox-level commands. By default, nose will discover tests
# beginning in the current working directory. We could override nose's
# behavior by adding an extra arg that specifies that the scope for
# discovery is the test root, but this would interfere with other logic
# that we have, that disables the running of compiled tests when any
# sort of constraining file/directory scope is given. So the simplest
# way to achieve our goal is to temporarily set the current working dir
# to the test root whenever no explicit scope is provided.
try:
restore_dir = os.getcwd()
os.chdir(sb.get_test_root()) # always run tests with the current directory being the test root
if '--with-id' not in argv: