2013-05-28 23:58:08 +02:00
|
|
|
from tests.lib.path import Path
|
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_from_wheel(script, data):
|
2013-05-28 23:58:08 +02:00
|
|
|
"""
|
|
|
|
Test installing from a wheel.
|
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', 'simple.dist', '--use-wheel',
|
2013-08-23 13:12:37 +02:00
|
|
|
'--no-index', '--find-links='+data.find_links,
|
2013-05-28 23:58:08 +02:00
|
|
|
expect_error=False)
|
2013-08-21 11:16:07 +02:00
|
|
|
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)
|
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
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
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', 'complex-dist[simple]', '--use-wheel',
|
2013-08-23 13:12:37 +02:00
|
|
|
'--no-index', '--find-links='+data.find_links,
|
2013-05-28 23:58:08 +02:00
|
|
|
expect_error=False)
|
2013-08-21 11:16:07 +02:00
|
|
|
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)
|
2013-08-21 11:16:07 +02:00
|
|
|
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)
|
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_from_wheel_file(script, data):
|
2013-05-28 23:58:08 +02:00
|
|
|
"""
|
|
|
|
Test installing directly from a wheel file.
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
package = data.packages.join("headers.dist-0.1-py2.py3-none-any.whl")
|
2013-08-21 11:16:07 +02:00
|
|
|
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)
|
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_wheel_with_target(script, data):
|
2013-05-28 23:58:08 +02:00
|
|
|
"""
|
|
|
|
Test installing a wheel using pip install --target
|
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
script.pip_install_local('wheel')
|
|
|
|
target_dir = script.scratch_path/'target'
|
|
|
|
result = script.pip('install', 'simple.dist==0.1', '-t', target_dir, '--use-wheel',
|
2013-08-23 13:12:37 +02:00
|
|
|
'--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
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +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
|
2013-08-23 13:12:37 +02:00
|
|
|
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)
|
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
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
|
2013-08-23 13:12:37 +02:00
|
|
|
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)
|
2013-08-21 11:16:07 +02:00
|
|
|
pkg_folder = script.site_packages/'source'
|
2013-06-07 04:11:43 +02:00
|
|
|
assert pkg_folder not in result.files_created
|