1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
pip/tests/functional/test_install_wheel.py

76 lines
3.2 KiB
Python
Raw Normal View History

2013-05-28 23:58:08 +02:00
from tests.lib.path import Path
def test_install_from_wheel(script, data):
2013-05-28 23:58:08 +02:00
"""
Test installing from a wheel.
"""
result = script.pip('install', 'simple.dist', '--use-wheel',
'--no-index', '--find-links='+data.find_links,
2013-05-28 23:58:08 +02:00
expect_error=False)
dist_info_folder = script.site_packages/'simple.dist-0.1.dist-info'
2013-05-28 23:58:08 +02:00
assert dist_info_folder in result.files_created, (dist_info_folder,
result.files_created,
result.stdout)
def test_install_from_wheel_with_extras(script, data):
2013-05-28 23:58:08 +02:00
"""
2013-06-07 04:11:43 +02:00
Test installing from a wheel with extras.
2013-05-28 23:58:08 +02:00
"""
result = script.pip('install', 'complex-dist[simple]', '--use-wheel',
'--no-index', '--find-links='+data.find_links,
2013-05-28 23:58:08 +02:00
expect_error=False)
dist_info_folder = script.site_packages/'complex_dist-0.1.dist-info'
2013-05-28 23:58:08 +02:00
assert dist_info_folder in result.files_created, (dist_info_folder,
result.files_created,
result.stdout)
dist_info_folder = script.site_packages/'simple.dist-0.1.dist-info'
2013-05-28 23:58:08 +02:00
assert dist_info_folder in result.files_created, (dist_info_folder,
result.files_created,
result.stdout)
def test_install_from_wheel_file(script, data):
2013-05-28 23:58:08 +02:00
"""
Test installing directly from a wheel file.
"""
package = data.packages.join("headers.dist-0.1-py2.py3-none-any.whl")
result = script.pip('install', package, '--no-index', expect_error=False)
dist_info_folder = script.site_packages/'headers.dist-0.1.dist-info'
2013-05-28 23:58:08 +02:00
assert dist_info_folder in result.files_created, (dist_info_folder,
result.files_created,
result.stdout)
def test_install_wheel_with_target(script, data):
2013-05-28 23:58:08 +02:00
"""
Test installing a wheel using pip install --target
"""
script.pip_install_local('wheel')
target_dir = script.scratch_path/'target'
result = script.pip('install', 'simple.dist==0.1', '-t', target_dir, '--use-wheel',
'--no-index', '--find-links='+data.find_links)
2013-05-28 23:58:08 +02:00
assert Path('scratch')/'target'/'simpledist' in result.files_created, str(result)
2013-06-07 04:11:43 +02:00
def test_install_from_wheel_installs_deps(script, data):
2013-06-07 04:11:43 +02:00
"""
Test can install dependencies of wheels
"""
# 'requires_source' depends on the 'source' project
package = data.packages.join("requires_source-1.0-py2.py3-none-any.whl")
result = script.pip('install', '--no-index', '--find-links', data.find_links, package)
2013-06-07 04:11:43 +02:00
result.assert_installed('source', editable=False)
def test_install_from_wheel_no_deps(script, data):
2013-06-07 04:11:43 +02:00
"""
Test --no-deps works with wheel installs
"""
# 'requires_source' depends on the 'source' project
package = data.packages.join("requires_source-1.0-py2.py3-none-any.whl")
result = script.pip('install', '--no-index', '--find-links', data.find_links, '--no-deps', package)
pkg_folder = script.site_packages/'source'
2013-06-07 04:11:43 +02:00
assert pkg_folder not in result.files_created