2017-05-16 12:16:30 +02:00
|
|
|
import glob
|
2013-10-29 12:40:30 +01:00
|
|
|
import os
|
2015-11-16 17:39:44 +01:00
|
|
|
import sys
|
2013-11-22 03:59:31 +01:00
|
|
|
|
2017-05-16 12:16:30 +02:00
|
|
|
import pytest
|
2017-06-13 14:17:00 +02:00
|
|
|
|
2013-05-28 23:58:08 +02:00
|
|
|
from tests.lib.path import Path
|
|
|
|
|
|
|
|
|
2014-02-15 07:21:22 +01:00
|
|
|
def test_install_from_future_wheel_version(script, data):
|
|
|
|
"""
|
2014-02-18 05:20:12 +01:00
|
|
|
Test installing a future wheel
|
2014-02-15 07:21:22 +01:00
|
|
|
"""
|
2016-07-29 02:36:45 +02:00
|
|
|
from tests.lib import TestFailure
|
|
|
|
|
2014-02-15 07:21:22 +01:00
|
|
|
package = data.packages.join("futurewheel-3.0-py2.py3-none-any.whl")
|
|
|
|
result = script.pip('install', package, '--no-index', expect_error=True)
|
2014-02-15 07:47:44 +01:00
|
|
|
with pytest.raises(TestFailure):
|
|
|
|
result.assert_installed('futurewheel', without_egg_link=True,
|
|
|
|
editable=False)
|
|
|
|
|
|
|
|
package = data.packages.join("futurewheel-1.9-py2.py3-none-any.whl")
|
2015-03-16 13:34:52 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', package, '--no-index', expect_error=False,
|
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2014-02-15 07:47:44 +01:00
|
|
|
result.assert_installed('futurewheel', without_egg_link=True,
|
|
|
|
editable=False)
|
2014-02-15 07:21:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_install_from_broken_wheel(script, data):
|
|
|
|
"""
|
2014-02-18 05:20:12 +01:00
|
|
|
Test that installing a broken wheel fails properly
|
2014-02-15 07:21:22 +01:00
|
|
|
"""
|
2016-07-29 02:36:45 +02:00
|
|
|
from tests.lib import TestFailure
|
2014-02-15 07:21:22 +01:00
|
|
|
package = data.packages.join("brokenwheel-1.0-py2.py3-none-any.whl")
|
|
|
|
result = script.pip('install', package, '--no-index', expect_error=True)
|
2014-02-15 07:47:44 +01:00
|
|
|
with pytest.raises(TestFailure):
|
|
|
|
result.assert_installed('futurewheel', without_egg_link=True,
|
|
|
|
editable=False)
|
2014-02-15 07:21:22 +01:00
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_from_wheel(script, data):
|
2013-05-28 23:58:08 +02:00
|
|
|
"""
|
2013-08-31 17:17:02 +02:00
|
|
|
Test installing from a wheel (that has a script)
|
2013-05-28 23:58:08 +02:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'has.script==1.0', '--no-index',
|
2014-02-24 22:52:23 +01:00
|
|
|
'--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_error=False,
|
|
|
|
)
|
2014-02-24 22:52:23 +01:00
|
|
|
dist_info_folder = script.site_packages / 'has.script-1.0.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-09-01 22:15:45 +02:00
|
|
|
script_file = script.bin / 'script.py'
|
2013-08-31 17:17:02 +02:00
|
|
|
assert script_file in result.files_created
|
2013-05-28 23:58:08 +02:00
|
|
|
|
|
|
|
|
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
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'complex-dist[simple]', '--no-index',
|
2014-02-24 22:52:23 +01:00
|
|
|
'--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_error=False,
|
|
|
|
)
|
2014-02-24 22:52:23 +01: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)
|
2014-02-24 22:52:23 +01: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-12-08 23:05:08 +01:00
|
|
|
package = data.packages.join("simple.dist-0.1-py2.py3-none-any.whl")
|
|
|
|
result = script.pip('install', package, '--no-index', expect_error=False)
|
2014-02-24 22:52:23 +01:00
|
|
|
dist_info_folder = script.site_packages / 'simple.dist-0.1.dist-info'
|
2013-12-08 23:05:08 +01:00
|
|
|
assert dist_info_folder in result.files_created, (dist_info_folder,
|
|
|
|
result.files_created,
|
|
|
|
result.stdout)
|
2015-12-04 10:19:17 +01:00
|
|
|
installer = dist_info_folder / 'INSTALLER'
|
|
|
|
assert installer in result.files_created, (dist_info_folder,
|
|
|
|
result.files_created,
|
|
|
|
result.stdout)
|
|
|
|
with open(script.base_path / installer, 'rb') as installer_file:
|
|
|
|
installer_details = installer_file.read()
|
|
|
|
assert installer_details == b'pip\n'
|
|
|
|
installer_temp = dist_info_folder / 'INSTALLER.pip'
|
|
|
|
assert installer_temp not in result.files_created, (dist_info_folder,
|
|
|
|
result.files_created,
|
|
|
|
result.stdout)
|
2013-12-08 23:05:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
# header installs are broke in pypy virtualenvs
|
|
|
|
# https://github.com/pypa/virtualenv/issues/510
|
|
|
|
@pytest.mark.skipif("hasattr(sys, 'pypy_version_info')")
|
|
|
|
def test_install_from_wheel_with_headers(script, data):
|
|
|
|
"""
|
|
|
|
Test installing from a wheel file with headers
|
|
|
|
"""
|
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)
|
2014-02-24 22:52:23 +01:00
|
|
|
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)
|
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2017-05-14 00:23:17 +02:00
|
|
|
def test_install_wheel_with_target(script, data, common_wheels):
|
2013-05-28 23:58:08 +02:00
|
|
|
"""
|
|
|
|
Test installing a wheel using pip install --target
|
|
|
|
"""
|
2017-05-14 00:23:17 +02:00
|
|
|
script.pip('install', 'wheel', '--no-index', '-f', common_wheels)
|
2014-02-24 22:52:23 +01:00
|
|
|
target_dir = script.scratch_path / 'target'
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'simple.dist==0.1', '-t', target_dir,
|
2014-02-24 22:52:23 +01:00
|
|
|
'--no-index', '--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2014-02-24 22:52:23 +01:00
|
|
|
assert Path('scratch') / 'target' / 'simpledist' in result.files_created, (
|
2014-01-28 15:17:51 +01:00
|
|
|
str(result)
|
|
|
|
)
|
2013-06-07 04:11:43 +02:00
|
|
|
|
|
|
|
|
2017-03-26 23:55:50 +02:00
|
|
|
@pytest.mark.network
|
2017-05-14 00:23:17 +02:00
|
|
|
def test_install_wheel_with_target_and_data_files(script, data, common_wheels):
|
2017-03-26 23:55:50 +02:00
|
|
|
"""
|
|
|
|
Test for issue #4092. It will be checked that a data_files specification in
|
|
|
|
setup.py is handled correctly when a wheel is installed with the --target
|
|
|
|
option.
|
|
|
|
|
|
|
|
The setup() for the wheel 'prjwithdatafile-1.0-py2.py3-none-any.whl' is as
|
|
|
|
follows ::
|
|
|
|
|
|
|
|
setup(
|
|
|
|
name='prjwithdatafile',
|
|
|
|
version='1.0',
|
|
|
|
packages=['prjwithdatafile'],
|
|
|
|
data_files=[
|
|
|
|
(r'packages1', ['prjwithdatafile/README.txt']),
|
|
|
|
(r'packages2', ['prjwithdatafile/README.txt'])
|
|
|
|
]
|
|
|
|
)
|
|
|
|
"""
|
2017-05-14 00:23:17 +02:00
|
|
|
script.pip('install', 'wheel', '--no-index', '-f', common_wheels)
|
2017-03-26 23:55:50 +02:00
|
|
|
target_dir = script.scratch_path / 'prjwithdatafile'
|
|
|
|
package = data.packages.join("prjwithdatafile-1.0-py2.py3-none-any.whl")
|
|
|
|
result = script.pip('install', package,
|
|
|
|
'-t', target_dir,
|
|
|
|
'--no-index',
|
|
|
|
expect_error=False)
|
|
|
|
|
|
|
|
assert (Path('scratch') / 'prjwithdatafile' / 'packages1' / 'README.txt'
|
|
|
|
in result.files_created), str(result)
|
|
|
|
assert (Path('scratch') / 'prjwithdatafile' / 'packages2' / 'README.txt'
|
|
|
|
in result.files_created), str(result)
|
|
|
|
assert (Path('scratch') / 'prjwithdatafile' / 'lib' / 'python'
|
|
|
|
not in result.files_created), str(result)
|
|
|
|
|
|
|
|
|
2013-10-31 13:49:23 +01:00
|
|
|
def test_install_wheel_with_root(script, data):
|
|
|
|
"""
|
|
|
|
Test installing a wheel using pip install --root
|
|
|
|
"""
|
2014-02-24 22:52:23 +01:00
|
|
|
root_dir = script.scratch_path / 'root'
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'simple.dist==0.1', '--root', root_dir,
|
2014-02-24 22:52:23 +01:00
|
|
|
'--no-index', '--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2014-02-24 22:52:23 +01:00
|
|
|
assert Path('scratch') / 'root' in result.files_created
|
2013-10-31 13:49:23 +01:00
|
|
|
|
|
|
|
|
2015-11-16 17:39:44 +01:00
|
|
|
def test_install_wheel_with_prefix(script, data):
|
|
|
|
"""
|
|
|
|
Test installing a wheel using pip install --prefix
|
|
|
|
"""
|
|
|
|
prefix_dir = script.scratch_path / 'prefix'
|
|
|
|
result = script.pip(
|
|
|
|
'install', 'simple.dist==0.1', '--prefix', prefix_dir,
|
|
|
|
'--no-index', '--find-links=' + data.find_links,
|
|
|
|
)
|
|
|
|
if hasattr(sys, "pypy_version_info"):
|
|
|
|
lib = Path('scratch') / 'prefix' / 'site-packages'
|
|
|
|
else:
|
|
|
|
lib = Path('scratch') / 'prefix' / 'lib'
|
|
|
|
assert lib in result.files_created
|
|
|
|
|
|
|
|
|
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")
|
2014-01-28 15:17:51 +01:00
|
|
|
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")
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', '--no-index', '--find-links', data.find_links, '--no-deps',
|
|
|
|
package,
|
|
|
|
)
|
2014-02-24 22:52:23 +01:00
|
|
|
pkg_folder = script.site_packages / 'source'
|
2013-06-07 04:11:43 +02:00
|
|
|
assert pkg_folder not in result.files_created
|
|
|
|
|
2013-09-01 22:15:45 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2017-05-14 00:23:17 +02:00
|
|
|
def test_install_user_wheel(script, virtualenv, data, common_wheels):
|
2013-09-01 22:15:45 +02:00
|
|
|
"""
|
|
|
|
Test user install from wheel (that has a script)
|
|
|
|
"""
|
|
|
|
virtualenv.system_site_packages = True
|
2017-05-14 00:23:17 +02:00
|
|
|
script.pip('install', 'wheel', '--no-index', '-f', common_wheels)
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'has.script==1.0', '--user', '--no-index',
|
2014-02-24 22:52:23 +01:00
|
|
|
'--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2013-09-01 22:15:45 +02:00
|
|
|
egg_info_folder = script.user_site / 'has.script-1.0.dist-info'
|
|
|
|
assert egg_info_folder in result.files_created, str(result)
|
|
|
|
script_file = script.user_bin / 'script.py'
|
|
|
|
assert script_file in result.files_created
|
2013-10-29 12:40:30 +01:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
|
2013-10-29 12:40:30 +01:00
|
|
|
def test_install_from_wheel_gen_entrypoint(script, data):
|
|
|
|
"""
|
|
|
|
Test installing scripts (entry points are generated)
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'script.wheel1a==0.1', '--no-index',
|
2014-02-24 22:52:23 +01:00
|
|
|
'--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_error=False,
|
|
|
|
)
|
2013-10-29 12:40:30 +01:00
|
|
|
if os.name == 'nt':
|
|
|
|
wrapper_file = script.bin / 't1.exe'
|
|
|
|
else:
|
|
|
|
wrapper_file = script.bin / 't1'
|
|
|
|
assert wrapper_file in result.files_created
|
|
|
|
|
2013-11-02 17:03:29 +01:00
|
|
|
if os.name != "nt":
|
|
|
|
assert bool(os.access(script.base_path / wrapper_file, os.X_OK))
|
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
|
2016-01-03 23:31:21 +01:00
|
|
|
def test_install_from_wheel_gen_uppercase_entrypoint(script, data):
|
|
|
|
"""
|
|
|
|
Test installing scripts with uppercase letters in entry point names
|
|
|
|
"""
|
|
|
|
result = script.pip(
|
|
|
|
'install', 'console-scripts-uppercase==1.0', '--no-index',
|
|
|
|
'--find-links=' + data.find_links,
|
|
|
|
expect_error=False,
|
|
|
|
)
|
|
|
|
if os.name == 'nt':
|
|
|
|
# Case probably doesn't make any difference on NT
|
|
|
|
wrapper_file = script.bin / 'cmdName.exe'
|
|
|
|
else:
|
|
|
|
wrapper_file = script.bin / 'cmdName'
|
|
|
|
assert wrapper_file in result.files_created
|
|
|
|
|
|
|
|
if os.name != "nt":
|
|
|
|
assert bool(os.access(script.base_path / wrapper_file, os.X_OK))
|
|
|
|
|
|
|
|
|
2013-10-29 12:40:30 +01:00
|
|
|
def test_install_from_wheel_with_legacy(script, data):
|
|
|
|
"""
|
|
|
|
Test installing scripts (legacy scripts are preserved)
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'script.wheel2a==0.1', '--no-index',
|
2014-02-24 22:52:23 +01:00
|
|
|
'--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_error=False,
|
|
|
|
)
|
2013-10-29 12:40:30 +01:00
|
|
|
|
|
|
|
legacy_file1 = script.bin / 'testscript1.bat'
|
|
|
|
legacy_file2 = script.bin / 'testscript2'
|
|
|
|
|
|
|
|
assert legacy_file1 in result.files_created
|
|
|
|
assert legacy_file2 in result.files_created
|
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
|
2013-10-29 12:40:30 +01:00
|
|
|
def test_install_from_wheel_no_setuptools_entrypoint(script, data):
|
|
|
|
"""
|
2013-11-01 18:28:35 +01:00
|
|
|
Test that when we generate scripts, any existing setuptools wrappers in
|
|
|
|
the wheel are skipped.
|
2013-10-29 12:40:30 +01:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'script.wheel1==0.1', '--no-index',
|
2014-02-24 22:52:23 +01:00
|
|
|
'--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_error=False,
|
|
|
|
)
|
2013-10-29 12:40:30 +01:00
|
|
|
if os.name == 'nt':
|
|
|
|
wrapper_file = script.bin / 't1.exe'
|
|
|
|
else:
|
|
|
|
wrapper_file = script.bin / 't1'
|
|
|
|
wrapper_helper = script.bin / 't1-script.py'
|
|
|
|
|
2013-11-01 18:28:35 +01:00
|
|
|
# The wheel has t1.exe and t1-script.py. We will be generating t1 or
|
|
|
|
# t1.exe depending on the platform. So we check that the correct wrapper
|
|
|
|
# is present and that the -script.py helper has been skipped. We can't
|
|
|
|
# easily test that the wrapper from the wheel has been skipped /
|
|
|
|
# overwritten without getting very platform-dependent, so omit that.
|
2013-10-29 12:40:30 +01:00
|
|
|
assert wrapper_file in result.files_created
|
|
|
|
assert wrapper_helper not in result.files_created
|
|
|
|
|
|
|
|
|
|
|
|
def test_skipping_setuptools_doesnt_skip_legacy(script, data):
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
Test installing scripts (legacy scripts are preserved even when we skip
|
|
|
|
setuptools wrappers)
|
2013-10-29 12:40:30 +01:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'script.wheel2==0.1', '--no-index',
|
2014-02-24 22:52:23 +01:00
|
|
|
'--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_error=False,
|
|
|
|
)
|
2013-10-29 12:40:30 +01:00
|
|
|
|
|
|
|
legacy_file1 = script.bin / 'testscript1.bat'
|
|
|
|
legacy_file2 = script.bin / 'testscript2'
|
|
|
|
wrapper_helper = script.bin / 't1-script.py'
|
|
|
|
|
|
|
|
assert legacy_file1 in result.files_created
|
|
|
|
assert legacy_file2 in result.files_created
|
|
|
|
assert wrapper_helper not in result.files_created
|
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
|
2013-10-29 12:40:30 +01:00
|
|
|
def test_install_from_wheel_gui_entrypoint(script, data):
|
|
|
|
"""
|
|
|
|
Test installing scripts (gui entry points are generated)
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2015-04-20 03:27:27 +02:00
|
|
|
'install', 'script.wheel3==0.1', '--no-index',
|
2014-02-24 22:52:23 +01:00
|
|
|
'--find-links=' + data.find_links,
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_error=False,
|
|
|
|
)
|
2013-10-29 12:40:30 +01:00
|
|
|
if os.name == 'nt':
|
|
|
|
wrapper_file = script.bin / 't1.exe'
|
|
|
|
else:
|
|
|
|
wrapper_file = script.bin / 't1'
|
|
|
|
assert wrapper_file in result.files_created
|
|
|
|
|
2013-11-22 03:59:31 +01:00
|
|
|
|
|
|
|
def test_wheel_compiles_pyc(script, data):
|
|
|
|
"""
|
|
|
|
Test installing from wheel with --compile on
|
|
|
|
"""
|
|
|
|
script.pip(
|
|
|
|
"install", "--compile", "simple.dist==0.1", "--no-index",
|
|
|
|
"--find-links=" + data.find_links
|
|
|
|
)
|
|
|
|
# There are many locations for the __init__.pyc file so attempt to find
|
|
|
|
# any of them
|
|
|
|
exists = [
|
2014-02-24 22:52:23 +01:00
|
|
|
os.path.exists(script.site_packages_path / "simpledist/__init__.pyc"),
|
2013-11-22 03:59:31 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
exists += glob.glob(
|
2014-02-24 22:52:23 +01:00
|
|
|
script.site_packages_path / "simpledist/__pycache__/__init__*.pyc"
|
2013-11-22 03:59:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
assert any(exists)
|
|
|
|
|
|
|
|
|
|
|
|
def test_wheel_no_compiles_pyc(script, data):
|
|
|
|
"""
|
|
|
|
Test installing from wheel with --compile on
|
|
|
|
"""
|
|
|
|
script.pip(
|
|
|
|
"install", "--no-compile", "simple.dist==0.1", "--no-index",
|
|
|
|
"--find-links=" + data.find_links
|
|
|
|
)
|
|
|
|
# There are many locations for the __init__.pyc file so attempt to find
|
|
|
|
# any of them
|
|
|
|
exists = [
|
2014-02-24 22:52:23 +01:00
|
|
|
os.path.exists(script.site_packages_path / "simpledist/__init__.pyc"),
|
2013-11-22 03:59:31 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
exists += glob.glob(
|
2014-02-24 22:52:23 +01:00
|
|
|
script.site_packages_path / "simpledist/__pycache__/__init__*.pyc"
|
2013-11-22 03:59:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
assert not any(exists)
|
2014-05-26 06:00:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_install_from_wheel_uninstalls_old_version(script, data):
|
|
|
|
# regression test for https://github.com/pypa/pip/issues/1825
|
|
|
|
package = data.packages.join("simplewheel-1.0-py2.py3-none-any.whl")
|
|
|
|
result = script.pip('install', package, '--no-index', expect_error=True)
|
|
|
|
package = data.packages.join("simplewheel-2.0-py2.py3-none-any.whl")
|
|
|
|
result = script.pip('install', package, '--no-index', expect_error=False)
|
|
|
|
dist_info_folder = script.site_packages / 'simplewheel-2.0.dist-info'
|
|
|
|
assert dist_info_folder in result.files_created
|
|
|
|
dist_info_folder = script.site_packages / 'simplewheel-1.0.dist-info'
|
|
|
|
assert dist_info_folder not in result.files_created
|
2014-08-21 15:40:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_wheel_compile_syntax_error(script, data):
|
|
|
|
package = data.packages.join("compilewheel-1.0-py2.py3-none-any.whl")
|
|
|
|
result = script.pip('install', '--compile', package, '--no-index')
|
2014-09-29 10:51:04 +02:00
|
|
|
assert 'yield from' not in result.stdout
|
2014-08-21 15:40:02 +02:00
|
|
|
assert 'SyntaxError: ' not in result.stdout
|