本文整理汇总了Python中tests.helpers.captured函数的典型用法代码示例。如果您正苦于以下问题:Python captured函数的具体用法?Python captured怎么用?Python captured使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了captured函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_display_actions_no_index
def test_display_actions_no_index():
# Test removing a package that is not in the index. This issue
# should only come up for removing.
actions = defaultdict(list, {"UNLINK": ["notinstalled-1.0-py33_0"]})
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be REMOVED:
notinstalled: 1.0-py33_0 <unknown>
"""
)
actions = defaultdict(list, {"LINK": ["numpy-1.7.1-py33_0"], "UNLINK": ["numpy-2.0.0-py33_1"]})
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be DOWNGRADED:
numpy: 2.0.0-py33_1 <unknown> --> 1.7.1-py33_0 <unknown>
"""
)
# tk-8.5.13-1 is not in the index. Test that it guesses the build number
# correctly.
actions = defaultdict(list, {"LINK": ["tk-8.5.13-0"], "UNLINK": ["tk-8.5.13-1"]})
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be DOWNGRADED:
tk: 8.5.13-1 <unknown> --> 8.5.13-0 <unknown>
"""
)
开发者ID:quasiben,项目名称:conda,代码行数:49,代码来源:test_plan.py
示例2: run_command
def run_command(command, prefix, *arguments):
p, sub_parsers = generate_parser()
parser_config[command](sub_parsers)
prefix = escape_for_winpath(prefix)
arguments = list(map(escape_for_winpath, arguments))
if command is Commands.CONFIG:
command_line = "{0} --file {1} {2}".format(command, join(prefix, 'condarc'), " ".join(arguments))
elif command is Commands.SEARCH:
command_line = "{0} {1}".format(command, " ".join(arguments))
elif command is Commands.LIST:
command_line = "{0} -p {1} {2}".format(command, prefix, " ".join(arguments))
else: # CREATE, INSTALL, REMOVE, UPDATE
command_line = "{0} -y -q -p {1} {2}".format(command, prefix, " ".join(arguments))
args = p.parse_args(split(command_line))
context._add_argparse_args(args)
with captured(disallow_stderr=False) as c:
args.func(args, p)
print(c.stdout)
print(c.stderr, file=sys.stderr)
if command is Commands.CONFIG:
reload_config(prefix)
return c.stdout, c.stderr
开发者ID:uvyouver,项目名称:conda,代码行数:25,代码来源:test_create.py
示例3: test_display_actions_no_index
def test_display_actions_no_index():
# Test removing a package that is not in the index. This issue
# should only come up for removing.
actions = defaultdict(list, {'UNLINK': ['notinstalled-1.0-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be REMOVED:
notinstalled: 1.0-py33_0 <unknown>
"""
actions = defaultdict(list, {"LINK": ['numpy-1.7.1-py33_0'], "UNLINK":
['numpy-2.0.0-py33_1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be DOWNGRADED due to dependency conflicts:
numpy: 2.0.0-py33_1 <unknown> --> 1.7.1-py33_0 <unknown>
"""
# tk-8.5.13-1 is not in the index. Test that it guesses the build number
# correctly.
actions = defaultdict(list, {"LINK": ['tk-8.5.13-0'], "UNLINK":
['tk-8.5.13-1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
开发者ID:jaimergp,项目名称:conda,代码行数:37,代码来源:test_plan.py
示例4: run_command
def run_command(command, prefix, *arguments):
p = conda_argparse.ArgumentParser()
sub_parsers = p.add_subparsers(metavar='command', dest='cmd')
parser_config[command](sub_parsers)
prefix = escape_for_winpath(prefix)
arguments = list(map(escape_for_winpath, arguments))
flags = "" if command is Commands.LIST else "-y -q"
command_line = "{0} {1} -p {2} {3}".format(command, flags, prefix, " ".join(arguments))
args = p.parse_args(split(command_line))
with captured(disallow_stderr=False) as c:
args.func(args, p)
print(c.stdout)
print(c.stderr, file=sys.stderr)
return c.stdout, c.stderr
开发者ID:orangecms,项目名称:conda,代码行数:16,代码来源:test_create.py
示例5: test_display_actions_features
def test_display_actions_features():
conda.config.show_channel_urls = False
actions = defaultdict(list, {'LINK': ['numpy-1.7.1-py33_p0', 'cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
cython: 0.19-py33_0 \n\
numpy: 1.7.1-py33_p0 [mkl]
"""
actions = defaultdict(list, {'UNLINK': ['numpy-1.7.1-py33_p0', 'cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be REMOVED:
cython: 0.19-py33_0 \n\
numpy: 1.7.1-py33_p0 [mkl]
"""
actions = defaultdict(list, {'UNLINK': ['numpy-1.7.1-py33_p0'], 'LINK': ['numpy-1.7.0-py33_p0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be DOWNGRADED:
numpy: 1.7.1-py33_p0 [mkl] --> 1.7.0-py33_p0 [mkl]
"""
actions = defaultdict(list, {'LINK': ['numpy-1.7.1-py33_p0'], 'UNLINK': ['numpy-1.7.0-py33_p0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
numpy: 1.7.0-py33_p0 [mkl] --> 1.7.1-py33_p0 [mkl]
"""
actions = defaultdict(list, {'LINK': ['numpy-1.7.1-py33_p0'], 'UNLINK': ['numpy-1.7.1-py33_0']})
with captured() as c:
display_actions(actions, index)
# NB: Packages whose version do not changed are put in UPDATED
assert c.stdout == """
The following packages will be UPDATED:
numpy: 1.7.1-py33_0 --> 1.7.1-py33_p0 [mkl]
"""
actions = defaultdict(list, {'UNLINK': ['numpy-1.7.1-py33_p0'], 'LINK': ['numpy-1.7.1-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
numpy: 1.7.1-py33_p0 [mkl] --> 1.7.1-py33_0
"""
conda.config.show_channel_urls = True
actions = defaultdict(list, {'LINK': ['numpy-1.7.1-py33_p0', 'cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
cython: 0.19-py33_0 <unknown>
numpy: 1.7.1-py33_p0 <unknown> [mkl]
"""
actions = defaultdict(list, {'UNLINK': ['numpy-1.7.1-py33_p0', 'cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
#.........这里部分代码省略.........
开发者ID:Bbouley,项目名称:conda,代码行数:101,代码来源:test_plan.py
示例6: test_display_actions_link_type
def test_display_actions_link_type():
conda.config.show_channel_urls = False
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 2', 'dateutil-1.5-py33_0 /Users/aaronmeurer/anaconda/pkgs 2',
'numpy-1.7.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 2', 'python-3.3.2-0 /Users/aaronmeurer/anaconda/pkgs 2', 'readline-6.2-0 /Users/aaronmeurer/anaconda/pkgs 2', 'sqlite-3.7.13-0 /Users/aaronmeurer/anaconda/pkgs 2', 'tk-8.5.13-0 /Users/aaronmeurer/anaconda/pkgs 2', 'zlib-1.2.7-0 /Users/aaronmeurer/anaconda/pkgs 2']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
cython: 0.19.1-py33_0 (soft-link)
dateutil: 1.5-py33_0 (soft-link)
numpy: 1.7.1-py33_0 (soft-link)
python: 3.3.2-0 (soft-link)
readline: 6.2-0 (soft-link)
sqlite: 3.7.13-0 (soft-link)
tk: 8.5.13-0 (soft-link)
zlib: 1.2.7-0 (soft-link)
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 2',
'dateutil-2.1-py33_1 /Users/aaronmeurer/anaconda/pkgs 2'], 'UNLINK': ['cython-0.19-py33_0',
'dateutil-1.5-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
cython: 0.19-py33_0 --> 0.19.1-py33_0 (soft-link)
dateutil: 1.5-py33_0 --> 2.1-py33_1 (soft-link)
"""
actions = defaultdict(list, {'LINK': ['cython-0.19-py33_0 /Users/aaronmeurer/anaconda/pkgs 2',
'dateutil-1.5-py33_0 /Users/aaronmeurer/anaconda/pkgs 2'], 'UNLINK': ['cython-0.19.1-py33_0',
'dateutil-2.1-py33_1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be DOWNGRADED:
cython: 0.19.1-py33_0 --> 0.19-py33_0 (soft-link)
dateutil: 2.1-py33_1 --> 1.5-py33_0 (soft-link)
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 1', 'dateutil-1.5-py33_0 /Users/aaronmeurer/anaconda/pkgs 1',
'numpy-1.7.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 1', 'python-3.3.2-0 /Users/aaronmeurer/anaconda/pkgs 1', 'readline-6.2-0 /Users/aaronmeurer/anaconda/pkgs 1', 'sqlite-3.7.13-0 /Users/aaronmeurer/anaconda/pkgs 1', 'tk-8.5.13-0 /Users/aaronmeurer/anaconda/pkgs 1', 'zlib-1.2.7-0 /Users/aaronmeurer/anaconda/pkgs 1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
cython: 0.19.1-py33_0
dateutil: 1.5-py33_0 \n\
numpy: 1.7.1-py33_0 \n\
python: 3.3.2-0 \n\
readline: 6.2-0 \n\
sqlite: 3.7.13-0 \n\
tk: 8.5.13-0 \n\
zlib: 1.2.7-0 \n\
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 1',
'dateutil-2.1-py33_1 /Users/aaronmeurer/anaconda/pkgs 1'], 'UNLINK': ['cython-0.19-py33_0',
'dateutil-1.5-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
cython: 0.19-py33_0 --> 0.19.1-py33_0
dateutil: 1.5-py33_0 --> 2.1-py33_1 \n\
"""
actions = defaultdict(list, {'LINK': ['cython-0.19-py33_0 /Users/aaronmeurer/anaconda/pkgs 1',
'dateutil-1.5-py33_0 /Users/aaronmeurer/anaconda/pkgs 1'], 'UNLINK': ['cython-0.19.1-py33_0',
'dateutil-2.1-py33_1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be DOWNGRADED:
cython: 0.19.1-py33_0 --> 0.19-py33_0
dateutil: 2.1-py33_1 --> 1.5-py33_0 \n\
#.........这里部分代码省略.........
开发者ID:Bbouley,项目名称:conda,代码行数:101,代码来源:test_plan.py
示例7: test_display_actions_show_channel_urls
def test_display_actions_show_channel_urls():
conda.config.show_channel_urls = True
actions = defaultdict(list, {"FETCH": ['sympy-0.7.2-py27_0',
"numpy-1.7.1-py27_0"]})
# The older test index doesn't have the size metadata
index['sympy-0.7.2-py27_0.tar.bz2']['size'] = 4374752
index["numpy-1.7.1-py27_0.tar.bz2"]['size'] = 5994338
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be downloaded:
package | build
---------------------------|-----------------
sympy-0.7.2 | py27_0 4.2 MB <unknown>
numpy-1.7.1 | py27_0 5.7 MB <unknown>
------------------------------------------------------------
Total: 9.9 MB
"""
actions = defaultdict(list, {'PREFIX':
'/Users/aaronmeurer/anaconda/envs/test', 'SYMLINK_CONDA':
['/Users/aaronmeurer/anaconda'], 'LINK': ['python-3.3.2-0', 'readline-6.2-0 /Users/aaronmeurer/anaconda/pkgs 1', 'sqlite-3.7.13-0 /Users/aaronmeurer/anaconda/pkgs 1', 'tk-8.5.13-0 /Users/aaronmeurer/anaconda/pkgs 1', 'zlib-1.2.7-0 /Users/aaronmeurer/anaconda/pkgs 1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
python: 3.3.2-0 <unknown>
readline: 6.2-0 <unknown>
sqlite: 3.7.13-0 <unknown>
tk: 8.5.13-0 <unknown>
zlib: 1.2.7-0 <unknown>
"""
actions['UNLINK'] = actions['LINK']
actions['LINK'] = []
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be REMOVED:
python: 3.3.2-0 <unknown>
readline: 6.2-0 <unknown>
sqlite: 3.7.13-0 <unknown>
tk: 8.5.13-0 <unknown>
zlib: 1.2.7-0 <unknown>
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0'], 'UNLINK':
['cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
cython: 0.19-py33_0 <unknown> --> 0.19.1-py33_0 <unknown>
"""
actions['LINK'], actions['UNLINK'] = actions['UNLINK'], actions['LINK']
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be DOWNGRADED:
cython: 0.19.1-py33_0 <unknown> --> 0.19-py33_0 <unknown>
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0',
'dateutil-1.5-py33_0', 'numpy-1.7.1-py33_0'], 'UNLINK':
['cython-0.19-py33_0', 'dateutil-2.1-py33_1', 'pip-1.3.1-py33_1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
numpy: 1.7.1-py33_0 <unknown>
#.........这里部分代码省略.........
开发者ID:Bbouley,项目名称:conda,代码行数:101,代码来源:test_plan.py
示例8: test_display_actions_features
def test_display_actions_features():
os.environ['CONDA_SHOW_CHANNEL_URLS'] = 'False'
reset_context(())
actions = defaultdict(list, {'LINK': ['numpy-1.7.1-py33_p0', 'cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
cython: 0.19-py33_0 \n\
numpy: 1.7.1-py33_p0 [mkl]
"""
actions = defaultdict(list, {'UNLINK': ['numpy-1.7.1-py33_p0', 'cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be REMOVED:
cython: 0.19-py33_0 \n\
numpy: 1.7.1-py33_p0 [mkl]
"""
actions = defaultdict(list, {'UNLINK': ['numpy-1.7.1-py33_p0'], 'LINK': ['numpy-1.7.0-py33_p0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be DOWNGRADED due to dependency conflicts:
numpy: 1.7.1-py33_p0 [mkl] --> 1.7.0-py33_p0 [mkl]
"""
actions = defaultdict(list, {'LINK': ['numpy-1.7.1-py33_p0'], 'UNLINK': ['numpy-1.7.0-py33_p0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
numpy: 1.7.0-py33_p0 [mkl] --> 1.7.1-py33_p0 [mkl]
"""
actions = defaultdict(list, {'LINK': ['numpy-1.7.1-py33_p0'], 'UNLINK': ['numpy-1.7.1-py33_0']})
with captured() as c:
display_actions(actions, index)
# NB: Packages whose version do not changed are put in UPDATED
assert c.stdout == """
The following packages will be UPDATED:
numpy: 1.7.1-py33_0 --> 1.7.1-py33_p0 [mkl]
"""
actions = defaultdict(list, {'UNLINK': ['numpy-1.7.1-py33_p0'], 'LINK': ['numpy-1.7.1-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
numpy: 1.7.1-py33_p0 [mkl] --> 1.7.1-py33_0
"""
os.environ['CONDA_SHOW_CHANNEL_URLS'] = 'True'
reset_context(())
actions = defaultdict(list, {'LINK': ['numpy-1.7.1-py33_p0', 'cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
cython: 0.19-py33_0 <unknown>
numpy: 1.7.1-py33_p0 <unknown> [mkl]
"""
actions = defaultdict(list, {'UNLINK': ['numpy-1.7.1-py33_p0', 'cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
#.........这里部分代码省略.........
开发者ID:jaimergp,项目名称:conda,代码行数:101,代码来源:test_plan.py
示例9: test_display_actions_link_type
def test_display_actions_link_type():
os.environ['CONDA_SHOW_CHANNEL_URLS'] = 'False'
reset_context(())
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0 2', 'dateutil-1.5-py33_0 2',
'numpy-1.7.1-py33_0 2', 'python-3.3.2-0 2', 'readline-6.2-0 2', 'sqlite-3.7.13-0 2', 'tk-8.5.13-0 2', 'zlib-1.2.7-0 2']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
cython: 0.19.1-py33_0 (soft-link)
dateutil: 1.5-py33_0 (soft-link)
numpy: 1.7.1-py33_0 (soft-link)
python: 3.3.2-0 (soft-link)
readline: 6.2-0 (soft-link)
sqlite: 3.7.13-0 (soft-link)
tk: 8.5.13-0 (soft-link)
zlib: 1.2.7-0 (soft-link)
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0 2',
'dateutil-2.1-py33_1 2'], 'UNLINK': ['cython-0.19-py33_0',
'dateutil-1.5-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
cython: 0.19-py33_0 --> 0.19.1-py33_0 (soft-link)
dateutil: 1.5-py33_0 --> 2.1-py33_1 (soft-link)
"""
actions = defaultdict(list, {'LINK': ['cython-0.19-py33_0 2',
'dateutil-1.5-py33_0 2'], 'UNLINK': ['cython-0.19.1-py33_0',
'dateutil-2.1-py33_1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be DOWNGRADED due to dependency conflicts:
cython: 0.19.1-py33_0 --> 0.19-py33_0 (soft-link)
dateutil: 2.1-py33_1 --> 1.5-py33_0 (soft-link)
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0 1', 'dateutil-1.5-py33_0 1',
'numpy-1.7.1-py33_0 1', 'python-3.3.2-0 1', 'readline-6.2-0 1', 'sqlite-3.7.13-0 1', 'tk-8.5.13-0 1', 'zlib-1.2.7-0 1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
cython: 0.19.1-py33_0
dateutil: 1.5-py33_0 \n\
numpy: 1.7.1-py33_0 \n\
python: 3.3.2-0 \n\
readline: 6.2-0 \n\
sqlite: 3.7.13-0 \n\
tk: 8.5.13-0 \n\
zlib: 1.2.7-0 \n\
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0 1',
'dateutil-2.1-py33_1 1'], 'UNLINK': ['cython-0.19-py33_0',
'dateutil-1.5-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
cython: 0.19-py33_0 --> 0.19.1-py33_0
dateutil: 1.5-py33_0 --> 2.1-py33_1 \n\
"""
actions = defaultdict(list, {'LINK': ['cython-0.19-py33_0 1',
'dateutil-1.5-py33_0 1'], 'UNLINK': ['cython-0.19.1-py33_0',
'dateutil-2.1-py33_1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be DOWNGRADED due to dependency conflicts:
cython: 0.19.1-py33_0 --> 0.19-py33_0
#.........这里部分代码省略.........
开发者ID:jaimergp,项目名称:conda,代码行数:101,代码来源:test_plan.py
示例10: test_display_actions
def test_display_actions():
os.environ['CONDA_SHOW_CHANNEL_URLS'] = 'False'
reset_context(())
actions = defaultdict(list, {"FETCH": ['sympy-0.7.2-py27_0', "numpy-1.7.1-py27_0"]})
# The older test index doesn't have the size metadata
index['sympy-0.7.2-py27_0.tar.bz2']['size'] = 4374752
index["numpy-1.7.1-py27_0.tar.bz2"]['size'] = 5994338
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be downloaded:
package | build
---------------------------|-----------------
sympy-0.7.2 | py27_0 4.2 MB
numpy-1.7.1 | py27_0 5.7 MB
------------------------------------------------------------
Total: 9.9 MB
"""
actions = defaultdict(list, {'PREFIX':
'/Users/aaronmeurer/anaconda/envs/test', 'SYMLINK_CONDA':
['/Users/aaronmeurer/anaconda'], 'LINK': ['python-3.3.2-0', 'readline-6.2-0 1', 'sqlite-3.7.13-0 1', 'tk-8.5.13-0 1', 'zlib-1.2.7-0 1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
python: 3.3.2-0 \n\
readline: 6.2-0 \n\
sqlite: 3.7.13-0
tk: 8.5.13-0
zlib: 1.2.7-0 \n\
"""
actions['UNLINK'] = actions['LINK']
actions['LINK'] = []
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be REMOVED:
python: 3.3.2-0 \n\
readline: 6.2-0 \n\
sqlite: 3.7.13-0
tk: 8.5.13-0
zlib: 1.2.7-0 \n\
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0'], 'UNLINK':
['cython-0.19-py33_0']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be UPDATED:
cython: 0.19-py33_0 --> 0.19.1-py33_0
"""
actions['LINK'], actions['UNLINK'] = actions['UNLINK'], actions['LINK']
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following packages will be DOWNGRADED due to dependency conflicts:
cython: 0.19.1-py33_0 --> 0.19-py33_0
"""
actions = defaultdict(list, {'LINK': ['cython-0.19.1-py33_0',
'dateutil-1.5-py33_0', 'numpy-1.7.1-py33_0'], 'UNLINK':
['cython-0.19-py33_0', 'dateutil-2.1-py33_1', 'pip-1.3.1-py33_1']})
with captured() as c:
display_actions(actions, index)
assert c.stdout == """
The following NEW packages will be INSTALLED:
numpy: 1.7.1-py33_0
The following packages will be REMOVED:
pip: 1.3.1-py33_1
The following packages will be UPDATED:
#.........这里部分代码省略.........
开发者ID:jaimergp,项目名称:conda,代码行数:101,代码来源:test_plan.py
示例11: test_display_actions_link_type
def test_display_actions_link_type():
conda.config.show_channel_urls = False
actions = defaultdict(
list,
{
"LINK": [
"cython-0.19.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 2",
"dateutil-1.5-py33_0 /Users/aaronmeurer/anaconda/pkgs 2",
"numpy-1.7.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 2",
"python-3.3.2-0 /Users/aaronmeurer/anaconda/pkgs 2",
"readline-6.2-0 /Users/aaronmeurer/anaconda/pkgs 2",
"sqlite-3.7.13-0 /Users/aaronmeurer/anaconda/pkgs 2",
"tk-8.5.13-0 /Users/aaronmeurer/anaconda/pkgs 2",
"zlib-1.2.7-0 /Users/aaronmeurer/anaconda/pkgs 2",
]
},
)
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following NEW packages will be INSTALLED:
cython: 0.19.1-py33_0 (soft-link)
dateutil: 1.5-py33_0 (soft-link)
numpy: 1.7.1-py33_0 (soft-link)
python: 3.3.2-0 (soft-link)
readline: 6.2-0 (soft-link)
sqlite: 3.7.13-0 (soft-link)
tk: 8.5.13-0 (soft-link)
zlib: 1.2.7-0 (soft-link)
"""
)
actions = defaultdict(
list,
{
"LINK": [
"cython-0.19.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 2",
"dateutil-2.1-py33_1 /Users/aaronmeurer/anaconda/pkgs 2",
],
"UNLINK": ["cython-0.19-py33_0", "dateutil-1.5-py33_0"],
},
)
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be UPDATED:
cython: 0.19-py33_0 --> 0.19.1-py33_0 (soft-link)
dateutil: 1.5-py33_0 --> 2.1-py33_1 (soft-link)
"""
)
actions = defaultdict(
list,
{
"LINK": [
"cython-0.19-py33_0 /Users/aaronmeurer/anaconda/pkgs 2",
"dateutil-1.5-py33_0 /Users/aaronmeurer/anaconda/pkgs 2",
],
"UNLINK": ["cython-0.19.1-py33_0", "dateutil-2.1-py33_1"],
},
)
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be DOWNGRADED:
cython: 0.19.1-py33_0 --> 0.19-py33_0 (soft-link)
dateutil: 2.1-py33_1 --> 1.5-py33_0 (soft-link)
"""
)
actions = defaultdict(
list,
{
"LINK": [
"cython-0.19.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 1",
"dateutil-1.5-py33_0 /Users/aaronmeurer/anaconda/pkgs 1",
"numpy-1.7.1-py33_0 /Users/aaronmeurer/anaconda/pkgs 1",
"python-3.3.2-0 /Users/aaronmeurer/anaconda/pkgs 1",
"readline-6.2-0 /Users/aaronmeurer/anaconda/pkgs 1",
"sqlite-3.7.13-0 /Users/aaronmeurer/anaconda/pkgs 1",
"tk-8.5.13-0 /Users/aaronmeurer/anaconda/pkgs 1",
#.........这里部分代码省略.........
开发者ID:quasiben,项目名称:conda,代码行数:101,代码来源:test_plan.py
示例12: test_display_actions_show_channel_urls
def test_display_actions_show_channel_urls():
conda.config.show_channel_urls = True
actions = defaultdict(list, {"FETCH": ["sympy-0.7.2-py27_0", "numpy-1.7.1-py27_0"]})
# The older test index doesn't have the size metadata
index["sympy-0.7.2-py27_0.tar.bz2"]["size"] = 4374752
index["numpy-1.7.1-py27_0.tar.bz2"]["size"] = 5994338
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be downloaded:
package | build
---------------------------|-----------------
sympy-0.7.2 | py27_0 4.2 MB <unknown>
numpy-1.7.1 | py27_0 5.7 MB <unknown>
------------------------------------------------------------
Total: 9.9 MB
"""
)
actions = defaultdict(
list,
{
"PREFIX": "/Users/aaronmeurer/anaconda/envs/test",
"SYMLINK_CONDA": ["/Users/aaronmeurer/anaconda"],
"LINK": [
"python-3.3.2-0",
"readline-6.2-0 /Users/aaronmeurer/anaconda/pkgs 1",
"sqlite-3.7.13-0 /Users/aaronmeurer/anaconda/pkgs 1",
"tk-8.5.13-0 /Users/aaronmeurer/anaconda/pkgs 1",
"zlib-1.2.7-0 /Users/aaronmeurer/anaconda/pkgs 1",
],
},
)
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following NEW packages will be INSTALLED:
python: 3.3.2-0 <unknown>
readline: 6.2-0 <unknown>
sqlite: 3.7.13-0 <unknown>
tk: 8.5.13-0 <unknown>
zlib: 1.2.7-0 <unknown>
"""
)
actions["UNLINK"] = actions["LINK"]
actions["LINK"] = []
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be REMOVED:
python: 3.3.2-0 <unknown>
readline: 6.2-0 <unknown>
sqlite: 3.7.13-0 <unknown>
tk: 8.5.13-0 <unknown>
zlib: 1.2.7-0 <unknown>
"""
)
actions = defaultdict(list, {"LINK": ["cython-0.19.1-py33_0"], "UNLINK": ["cython-0.19-py33_0"]})
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be UPDATED:
cython: 0.19-py33_0 <unknown> --> 0.19.1-py33_0 <unknown>
"""
)
actions["LINK"], actions["UNLINK"] = actions["UNLINK"], actions["LINK"]
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
#.........这里部分代码省略.........
开发者ID:quasiben,项目名称:conda,代码行数:101,代码来源:test_plan.py
示例13: test_display_actions_link_type
def test_display_actions_link_type():
os.environ["CONDA_SHOW_CHANNEL_URLS"] = "False"
reset_context(())
actions = defaultdict(
list,
{
"LINK": [
"cython-0.19.1-py33_0 2",
"dateutil-1.5-py33_0 2",
"numpy-1.7.1-py33_0 2",
"python-3.3.2-0 2",
"readline-6.2-0 2",
"sqlite-3.7.13-0 2",
"tk-8.5.13-0 2",
"zlib-1.2.7-0 2",
]
},
)
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following NEW packages will be INSTALLED:
cython: 0.19.1-py33_0 (softlink)
dateutil: 1.5-py33_0 (softlink)
numpy: 1.7.1-py33_0 (softlink)
python: 3.3.2-0 (softlink)
readline: 6.2-0 (softlink)
sqlite: 3.7.13-0 (softlink)
tk: 8.5.13-0 (softlink)
zlib: 1.2.7-0 (softlink)
"""
)
actions = defaultdict(
list,
{
"LINK": ["cython-0.19.1-py33_0 2", "dateutil-2.1-py33_1 2"],
"UNLINK": ["cython-0.19-py33_0", "dateutil-1.5-py33_0"],
},
)
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be UPDATED:
cython: 0.19-py33_0 --> 0.19.1-py33_0 (softlink)
dateutil: 1.5-py33_0 --> 2.1-py33_1 (softlink)
"""
)
actions = defaultdict(
list,
{
"LINK": ["cython-0.19-py33_0 2", "dateutil-1.5-py33_0 2"],
"UNLINK": ["cython-0.19.1-py33_0", "dateutil-2.1-py33_1"],
},
)
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be DOWNGRADED due to dependency conflicts:
cython: 0.19.1-py33_0 --> 0.19-py33_0 (softlink)
dateutil: 2.1-py33_1 --> 1.5-py33_0 (softlink)
"""
)
actions = defaultdict(
list,
{
"LINK": [
"cython-0.19.1-py33_0 1",
"dateutil-1.5-py33_0 1",
"numpy-1.7.1-py33_0 1",
"python-3.3.2-0 1",
"readline-6.2-0 1",
"sqlite-3.7.13-0 1",
"tk-8.5.13-0 1",
"zlib-1.2.7-0 1",
]
},
)
#.........这里部分代码省略.........
开发者ID:jakirkham,项目名称:conda,代码行数:101,代码来源:test_plan.py
示例14: test_display_actions
def test_display_actions():
os.environ["CONDA_SHOW_CHANNEL_URLS"] = "False"
reset_context(())
actions = defaultdict(list, {"FETCH": [Dist("sympy-0.7.2-py27_0"), Dist("numpy-1.7.1-py27_0")]})
# The older test index doesn't have the size metadata
index[Dist.from_string("sympy-0.7.2-py27_0.tar.bz2")]["size"] = 4374752
index[Dist.from_string("numpy-1.7.1-py27_0.tar.bz2")]["size"] = 5994338
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be downloaded:
package | build
---------------------------|-----------------
sympy-0.7.2 | py27_0 4.2 MB
numpy-1.7.1 | py27_0 5.7 MB
------------------------------------------------------------
Total: 9.9 MB
"""
)
actions = defaultdict(
list,
{
"PREFIX": "/Users/aaronmeurer/anaconda/envs/test",
"SYMLINK_CONDA": ["/Users/aaronmeurer/anaconda"],
"LINK": ["python-3.3.2-0", "readline-6.2-0 1", "sqlite-3.7.13-0 1", "tk-8.5.13-0 1", "zlib-1.2.7-0 1"],
},
)
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following NEW packages will be INSTALLED:
python: 3.3.2-0 \n\
readline: 6.2-0 \n\
sqlite: 3.7.13-0
tk: 8.5.13-0
zlib: 1.2.7-0 \n\
"""
)
actions["UNLINK"] = actions["LINK"]
actions["LINK"] = []
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be REMOVED:
python: 3.3.2-0 \n\
readline: 6.2-0 \n\
sqlite: 3.7.13-0
tk: 8.5.13-0
zlib: 1.2.7-0 \n\
"""
)
actions = defaultdict(list, {"LINK": ["cython-0.19.1-py33_0"], "UNLINK": ["cython-0.19-py33_0"]})
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be UPDATED:
cython: 0.19-py33_0 --> 0.19.1-py33_0
"""
)
actions["LINK"], actions["UNLINK"] = actions["UNLINK"], actions["LINK"]
with captured() as c:
display_actions(actions, index)
assert (
c.stdout
== """
The following packages will be DOWNGRADED due to dependency conflicts:
cython: 0.19.1-py33_0 --> 0.19-py33_0
"""
#.........这里部分代码省略.........
开发者ID:jakirkham,项目名称:conda,代码行数:101,代码来源:test_plan.py
注:本文中的tests.helpers.captured函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论