本文整理汇总了Python中testing.venv_update函数的典型用法代码示例。如果您正苦于以下问题:Python venv_update函数的具体用法?Python venv_update怎么用?Python venv_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了venv_update函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_multiple_issues
def test_multiple_issues(tmpdir):
# Make it a bit worse. The output should show all three issues.
tmpdir.chdir()
T.requirements('flake8==2.2.5')
T.venv_update()
T.run('./virtualenv_run/bin/pip', 'uninstall', '--yes', 'pyflakes')
T.requirements('''
# flake8 2.2.5 requires mccabe>=0.2.1 and pep8>=1.5.7, so this isn't satisfiable
flake8==2.2.5
mccabe==0.2
pep8==1.0
''')
with pytest.raises(CalledProcessError) as excinfo:
T.venv_update()
assert excinfo.value.returncode == 1
out, err = excinfo.value.result
err = T.strip_coverage_warnings(err)
assert err == ''
out = T.uncolor(out)
assert (
'''
Cleaning up...
Error: version conflict: mccabe 0.2 (virtualenv_run/%s)'''
''' <-> mccabe>=0.2.1 (from flake8==2.2.5 (from -r requirements.txt (line 3)))
Error: version conflict: pep8 1.0 (virtualenv_run/%s) '''
'''<-> pep8>=1.5.7 (from flake8==2.2.5 (from -r requirements.txt (line 3)))
Error: unmet dependency: pyflakes>=0.8.1 (from flake8==2.2.5 (from -r requirements.txt (line 3)))
Something went wrong! Sending 'virtualenv_run' back in time, so make knows it's invalid.
''' % (PYTHON_LIB, PYTHON_LIB)
) in out
开发者ID:ENuge,项目名称:pip-faster,代码行数:35,代码来源:conflict_test.py
示例2: it_gives_the_same_python_version_as_we_started_with
def it_gives_the_same_python_version_as_we_started_with(tmpdir):
other_python = OtherPython()
with tmpdir.as_cwd():
requirements('')
# first simulate some unrelated use of venv-update
# this guards against statefulness in the venv-update scratch dir
venv_update('unrelated_venv', '--', '--version')
run('virtualenv', '--python', other_python.interpreter, 'venv')
initial_version = assert_python_version(other_python.version_prefix)
venv_update_symlink_pwd()
out, err = run('./venv/bin/python', 'venv_update.py')
assert err == ''
out = uncolor(out)
assert out.startswith('''\
> virtualenv
Keeping valid virtualenv from previous run.
> venv/bin/python -m pip.__main__ install pip-faster==%s
''' % __version__)
final_version = assert_python_version(other_python.version_prefix)
assert final_version == initial_version
开发者ID:jolynch,项目名称:pip-faster,代码行数:25,代码来源:validation.py
示例3: venv_setup
def venv_setup():
# First just set up a blank virtualenv, this'll bypass the
# bootstrap when we're actually testing for speed
if not Path('venv').exists():
requirements('')
venv_update()
install_coverage()
# Now the actual requirements we'll install
requirements('\n'.join((
'project_with_c',
'pure_python_package==0.2.1',
'slow_python_package==0.1.0',
'dependant_package',
'many_versions_package>=2,<3',
''
)))
yield
expected = '\n'.join((
'dependant-package==1',
'implicit-dependency==1',
'many-versions-package==2.1',
'project-with-c==0.1.0',
'pure-python-package==0.2.1',
'slow-python-package==0.1.0',
'venv-update==%s' % __version__,
''
))
assert pip_freeze() == expected
开发者ID:Yelp,项目名称:venv-update,代码行数:31,代码来源:faster.py
示例4: test_package_name_normalization
def test_package_name_normalization(tmpdir):
with tmpdir.as_cwd():
enable_coverage(tmpdir)
requirements('WEIRD_cAsing-packAge')
venv_update()
assert '\nweird-CASING-pACKage==' in pip_freeze()
开发者ID:jolynch,项目名称:pip-faster,代码行数:7,代码来源:simple_test.py
示例5: test_conflicting_reqs
def test_conflicting_reqs(tmpdir):
tmpdir.chdir()
T.requirements('''
# flake8 2.2.5 requires mccabe>=0.2.1, so this isn't satisfiable
flake8==2.2.5
mccabe==0.2
''')
with pytest.raises(CalledProcessError) as excinfo:
T.venv_update()
assert excinfo.value.returncode == 1
out, err = excinfo.value.result
err = T.strip_coverage_warnings(err)
assert err == ''
out = T.uncolor(out)
assert (
'''
Cleaning up...
Error: version conflict: mccabe 0.2 (virtualenv_run/%s)'''
''' <-> mccabe>=0.2.1 (from flake8==2.2.5 (from -r requirements.txt (line 3)))
Something went wrong! Sending 'virtualenv_run' back in time, so make knows it's invalid.
''' % PYTHON_LIB
) in out
开发者ID:ENuge,项目名称:pip-faster,代码行数:26,代码来源:conflict_test.py
示例6: flake8_older
def flake8_older():
requirements('''\
flake8==2.0
# last pyflakes release before 0.8 was 0.7.3
pyflakes<0.8
# simply to prevent these from drifting:
mccabe<=0.3
pep8<=1.5.7
-r %s/requirements.d/coverage.txt
''' % TOP)
venv_update()
assert pip_freeze() == '\n'.join((
'coverage==4.0.3',
'coverage-enable-subprocess==0',
'flake8==2.0',
'mccabe==0.3',
'pep8==1.5.7',
'pip-faster==' + __version__,
'pyflakes==0.7.3',
'virtualenv==1.11.6',
'wheel==0.29.0',
''
))
开发者ID:jolynch,项目名称:pip-faster,代码行数:25,代码来源:simple_test.py
示例7: flake8_newer
def flake8_newer():
requirements('''\
flake8==2.2.5
# we expect 0.8.1
pyflakes<=0.8.1
# simply to prevent these from drifting:
mccabe<=0.3
pep8<=1.5.7
-r %s/requirements.d/coverage.txt
''' % TOP)
venv_update()
assert pip_freeze() == '\n'.join((
'coverage==4.0.3',
'coverage-enable-subprocess==0',
'flake8==2.2.5',
'mccabe==0.3',
'pep8==1.5.7',
'pip-faster==' + __version__,
'pyflakes==0.8.1',
'virtualenv==1.11.6',
'wheel==0.29.0',
''
))
开发者ID:jolynch,项目名称:pip-faster,代码行数:25,代码来源:simple_test.py
示例8: it_gives_the_same_python_version_as_we_started_with
def it_gives_the_same_python_version_as_we_started_with(tmpdir):
other_python = OtherPython()
with tmpdir.as_cwd():
requirements('')
# first simulate some unrelated use of venv-update
# this guards against statefulness in the venv-update scratch dir
venv_update('venv=', 'unrelated_venv', 'pip-command=', 'true')
run('virtualenv', '--python', other_python.interpreter, 'venv')
initial_version = assert_python_version(other_python.version_prefix)
venv_update_symlink_pwd()
out, err = run('./venv/bin/python', 'venv_update.py')
err = strip_pip_warnings(err)
assert err == ''
out = uncolor(out)
assert out.startswith('''\
> virtualenv venv
Keeping valid virtualenv from previous run.
> rm -rf venv/local
> pip install venv-update=={}
'''.format(__version__))
final_version = assert_python_version(other_python.version_prefix)
assert final_version == initial_version
开发者ID:Yelp,项目名称:venv-update,代码行数:27,代码来源:validation.py
示例9: test_symlink_is_relative
def test_symlink_is_relative(tmpdir):
"""We want to be able to mount ~/.cache/venv-update in different locations
safely, so the symlink must be relative.
https://github.com/Yelp/pip-faster/issues/101
"""
tmpdir.chdir()
scratch_dir = tmpdir.join('home', '.cache').ensure_dir('venv-update').ensure_dir(__version__)
symlink = scratch_dir.join('venv-update')
# run a trivial venv-update to populate the cache and create a proper symlink
assert not symlink.exists()
requirements('')
venv_update()
# it should be a valid, relative symlink
assert symlink.exists()
assert not symlink.readlink().startswith('/')
# and if we move the entire scratch directory, the symlink should still be valid
# (this is what we really care about)
scratch_dir.move(tmpdir.join('derp'))
symlink = tmpdir.join('derp', 'venv-update')
assert symlink.exists()
开发者ID:jolynch,项目名称:pip-faster,代码行数:25,代码来源:venv_update.py
示例10: test_conflicting_reqs
def test_conflicting_reqs(tmpdir):
tmpdir.chdir()
T.requirements('''
dependant_package
conflicting_package
''')
with pytest.raises(CalledProcessError) as excinfo:
T.venv_update()
assert excinfo.value.returncode == 1
out, err = excinfo.value.result
err = T.strip_coverage_warnings(err)
err = T.strip_pip_warnings(err)
assert err == ''
out = T.uncolor(out)
assert (
'''
Cleaning up...
Error: version conflict: many-versions-package 3 (venv/%s)'''
''' <-> many-versions-package<2 (from conflicting-package->-r requirements.txt (line 3))
Storing debug log for failure in %s/home/.pip/pip.log
Something went wrong! Sending 'venv' back in time, so make knows it's invalid.
''' % (PYTHON_LIB, tmpdir)
) in out
assert_venv_marked_invalid(tmpdir.join('venv'))
开发者ID:jolynch,项目名称:pip-faster,代码行数:29,代码来源:conflict_test.py
示例11: test_conflicting_reqs
def test_conflicting_reqs(tmpdir):
tmpdir.chdir()
T.requirements('''
dependant_package
conflicting_package
''')
with pytest.raises(CalledProcessError) as excinfo:
T.venv_update()
assert excinfo.value.returncode == 1
out, err = excinfo.value.result
err = T.strip_coverage_warnings(err)
err = T.strip_pip_warnings(err)
assert err == (
"conflicting-package 1 has requirement many-versions-package<2, but you'll "
'have many-versions-package 3 which is incompatible.\n'
# TODO: do we still need to append our own error?
'Error: version conflict: many-versions-package 3 (venv/{}) '
'<-> many-versions-package<2 '
'(from conflicting_package->-r requirements.txt (line 3))\n'.format(
PYTHON_LIB,
)
)
out = T.uncolor(out)
assert_something_went_wrong(out)
assert_venv_marked_invalid(tmpdir.join('venv'))
开发者ID:Yelp,项目名称:venv-update,代码行数:29,代码来源:conflict_test.py
示例12: test_bad_symlink_can_be_fixed
def test_bad_symlink_can_be_fixed(tmpdir):
"""If the symlink at ~/.config/venv-update/$version/venv-update is wrong,
we should be able to fix it and keep going.
https://github.com/Yelp/pip-faster/issues/98
"""
tmpdir.chdir()
scratch_dir = tmpdir.join('home', '.cache').ensure_dir('venv-update').ensure_dir(__version__)
symlink = scratch_dir.join('venv-update')
# run a trivial venv-update to populate the cache and create a proper symlink
assert not symlink.exists()
requirements('')
venv_update()
assert symlink.exists()
# break the symlink by hand (in real life, this can happen if mounting
# things into Docker containers, for example)
symlink.remove()
symlink.mksymlinkto('/nonexist')
assert not symlink.exists()
# a simple venv-update should install packages and fix the symlink
enable_coverage(tmpdir)
requirements('pure-python-package')
venv_update()
assert '\npure-python-package==0.2.0\n' in pip_freeze()
assert symlink.exists()
开发者ID:jolynch,项目名称:pip-faster,代码行数:29,代码来源:venv_update.py
示例13: test_package_name_normalization_with_dots
def test_package_name_normalization_with_dots(tmpdir, install_req):
"""Packages with dots should be installable with either dots or dashes."""
with tmpdir.as_cwd():
enable_coverage()
requirements(install_req)
venv_update()
assert pip_freeze().startswith('dotted.package-name==')
开发者ID:Yelp,项目名称:venv-update,代码行数:8,代码来源:simple_test.py
示例14: test_not_installable_thing
def test_not_installable_thing(tmpdir):
tmpdir.chdir()
enable_coverage()
install_coverage()
requirements('not-a-real-package-plz')
with pytest.raises(CalledProcessError):
venv_update()
开发者ID:Yelp,项目名称:venv-update,代码行数:9,代码来源:simple_test.py
示例15: test_version
def test_version():
assert VERSION
out, err = venv_update('--version')
assert strip_coverage_warnings(err) == ''
assert out == VERSION + '\n'
out, err = venv_update('-V')
assert strip_coverage_warnings(err) == ''
assert out == VERSION + '\n'
开发者ID:Yelp,项目名称:venv-update,代码行数:10,代码来源:args.py
示例16: test_eggless_url
def test_eggless_url(tmpdir):
tmpdir.chdir()
enable_coverage()
# An arbitrary url requirement.
requirements('-e file://' + str(TOP / 'tests/testing/packages/pure_python_package'))
venv_update()
assert '#egg=pure_python_package' in pip_freeze()
开发者ID:Yelp,项目名称:venv-update,代码行数:10,代码来源:simple_test.py
示例17: test_trivial
def test_trivial(tmpdir):
tmpdir.chdir()
requirements('')
enable_coverage()
venv_update()
# Originally suggested by none other than @bukzor in:
# https://github.com/pypa/virtualenv/issues/118
# This directory now just causes problems (especially with relocating)
# since the debian issue has been fixed.
assert not tmpdir.join('venv', 'local').exists()
开发者ID:Yelp,项目名称:venv-update,代码行数:10,代码来源:simple_test.py
示例18: test_relocatable
def test_relocatable(tmpdir):
tmpdir.chdir()
requirements('')
venv_update()
Path('venv').rename('relocated')
python = 'relocated/bin/python'
assert Path(python).exists()
run(python, '-m', 'pip.__main__', '--version')
开发者ID:Yelp,项目名称:venv-update,代码行数:10,代码来源:relocation_test.py
示例19: test_relocatable
def test_relocatable(tmpdir):
tmpdir.chdir()
requirements('')
venv_update('--python=python') # this makes pypy work right. derp.
Path('virtualenv_run').rename('relocated')
python = 'relocated/bin/python'
assert Path(python).exists()
run(python, '-m', 'pip.__main__', '--version')
开发者ID:ENuge,项目名称:pip-faster,代码行数:10,代码来源:relocation_test.py
示例20: test_is_relocatable_different_python_version
def test_is_relocatable_different_python_version(tmpdir):
tmpdir.chdir()
with io.open('requirements.txt', 'w') as reqs:
reqs.write('doge==3.5.0')
python_arg = '--python=python' + ('2.7' if not PY27 else '2.6')
venv_update(python_arg)
run('sh', '-c', '. virtualenv_run/bin/activate && doge --help')
开发者ID:struys,项目名称:pip-faster,代码行数:10,代码来源:relocation_test.py
注:本文中的testing.venv_update函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论