mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Use shared_data fixture in wheel install tests
shared_data avoids copying the entire data directory, so use it in cases where we know pip won't have any opportunity to edit the data files (where we're passing tmpdir for --find-links).
This commit is contained in:
parent
d468da2796
commit
f5684ed7ae
|
@ -41,11 +41,13 @@ def test_install_from_broken_wheel(script, data):
|
|||
editable=False)
|
||||
|
||||
|
||||
def test_basic_install_from_wheel(script, data, tmpdir):
|
||||
def test_basic_install_from_wheel(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing from a wheel (that has a script)
|
||||
"""
|
||||
shutil.copy(data.packages / "has.script-1.0-py2.py3-none-any.whl", tmpdir)
|
||||
shutil.copy(
|
||||
shared_data.packages / "has.script-1.0-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
result = script.pip(
|
||||
'install', 'has.script==1.0', '--no-index',
|
||||
'--find-links', tmpdir,
|
||||
|
@ -58,14 +60,16 @@ def test_basic_install_from_wheel(script, data, tmpdir):
|
|||
assert script_file in result.files_created
|
||||
|
||||
|
||||
def test_basic_install_from_wheel_with_extras(script, data, tmpdir):
|
||||
def test_basic_install_from_wheel_with_extras(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing from a wheel with extras.
|
||||
"""
|
||||
shutil.copy(
|
||||
data.packages / "complex_dist-0.1-py2.py3-none-any.whl", tmpdir
|
||||
shared_data.packages / "complex_dist-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
shutil.copy(
|
||||
shared_data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
shutil.copy(data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir)
|
||||
result = script.pip(
|
||||
'install', 'complex-dist[simple]', '--no-index',
|
||||
'--find-links', tmpdir,
|
||||
|
@ -115,11 +119,13 @@ def test_install_from_wheel_with_headers(script, data):
|
|||
result.stdout)
|
||||
|
||||
|
||||
def test_install_wheel_with_target(script, data, with_wheel, tmpdir):
|
||||
def test_install_wheel_with_target(script, shared_data, with_wheel, tmpdir):
|
||||
"""
|
||||
Test installing a wheel using pip install --target
|
||||
"""
|
||||
shutil.copy(data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir)
|
||||
shutil.copy(
|
||||
shared_data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
target_dir = script.scratch_path / 'target'
|
||||
result = script.pip(
|
||||
'install', 'simple.dist==0.1', '-t', target_dir,
|
||||
|
@ -165,12 +171,14 @@ def test_install_wheel_with_target_and_data_files(script, data, with_wheel):
|
|||
not in result.files_created), str(result)
|
||||
|
||||
|
||||
def test_install_wheel_with_root(script, data, tmpdir):
|
||||
def test_install_wheel_with_root(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing a wheel using pip install --root
|
||||
"""
|
||||
root_dir = script.scratch_path / 'root'
|
||||
shutil.copy(data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir)
|
||||
shutil.copy(
|
||||
shared_data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
result = script.pip(
|
||||
'install', 'simple.dist==0.1', '--root', root_dir,
|
||||
'--no-index', '--find-links', tmpdir,
|
||||
|
@ -178,12 +186,14 @@ def test_install_wheel_with_root(script, data, tmpdir):
|
|||
assert Path('scratch') / 'root' in result.files_created
|
||||
|
||||
|
||||
def test_install_wheel_with_prefix(script, data, tmpdir):
|
||||
def test_install_wheel_with_prefix(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing a wheel using pip install --prefix
|
||||
"""
|
||||
prefix_dir = script.scratch_path / 'prefix'
|
||||
shutil.copy(data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir)
|
||||
shutil.copy(
|
||||
shared_data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
result = script.pip(
|
||||
'install', 'simple.dist==0.1', '--prefix', prefix_dir,
|
||||
'--no-index', '--find-links', tmpdir,
|
||||
|
@ -242,11 +252,13 @@ def test_wheel_record_lines_in_deterministic_order(script, data):
|
|||
|
||||
|
||||
@pytest.mark.incompatible_with_test_venv
|
||||
def test_install_user_wheel(script, data, with_wheel, tmpdir):
|
||||
def test_install_user_wheel(script, shared_data, with_wheel, tmpdir):
|
||||
"""
|
||||
Test user install from wheel (that has a script)
|
||||
"""
|
||||
shutil.copy(data.packages / "has.script-1.0-py2.py3-none-any.whl", tmpdir)
|
||||
shutil.copy(
|
||||
shared_data.packages / "has.script-1.0-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
result = script.pip(
|
||||
'install', 'has.script==1.0', '--user', '--no-index',
|
||||
'--find-links', tmpdir,
|
||||
|
@ -257,12 +269,13 @@ def test_install_user_wheel(script, data, with_wheel, tmpdir):
|
|||
assert script_file in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_from_wheel_gen_entrypoint(script, data, tmpdir):
|
||||
def test_install_from_wheel_gen_entrypoint(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing scripts (entry points are generated)
|
||||
"""
|
||||
shutil.copy(
|
||||
data.packages / "script.wheel1a-0.1-py2.py3-none-any.whl", tmpdir
|
||||
shared_data.packages / "script.wheel1a-0.1-py2.py3-none-any.whl",
|
||||
tmpdir,
|
||||
)
|
||||
result = script.pip(
|
||||
'install', 'script.wheel1a==0.1', '--no-index',
|
||||
|
@ -278,12 +291,15 @@ def test_install_from_wheel_gen_entrypoint(script, data, tmpdir):
|
|||
assert bool(os.access(script.base_path / wrapper_file, os.X_OK))
|
||||
|
||||
|
||||
def test_install_from_wheel_gen_uppercase_entrypoint(script, data, tmpdir):
|
||||
def test_install_from_wheel_gen_uppercase_entrypoint(
|
||||
script, shared_data, tmpdir
|
||||
):
|
||||
"""
|
||||
Test installing scripts with uppercase letters in entry point names
|
||||
"""
|
||||
shutil.copy(
|
||||
data.packages / "console_scripts_uppercase-1.0-py2.py3-none-any.whl",
|
||||
shared_data.packages /
|
||||
"console_scripts_uppercase-1.0-py2.py3-none-any.whl",
|
||||
tmpdir,
|
||||
)
|
||||
result = script.pip(
|
||||
|
@ -301,12 +317,13 @@ def test_install_from_wheel_gen_uppercase_entrypoint(script, data, tmpdir):
|
|||
assert bool(os.access(script.base_path / wrapper_file, os.X_OK))
|
||||
|
||||
|
||||
def test_install_from_wheel_with_legacy(script, data, tmpdir):
|
||||
def test_install_from_wheel_with_legacy(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing scripts (legacy scripts are preserved)
|
||||
"""
|
||||
shutil.copy(
|
||||
data.packages / "script.wheel2a-0.1-py2.py3-none-any.whl", tmpdir
|
||||
shared_data.packages / "script.wheel2a-0.1-py2.py3-none-any.whl",
|
||||
tmpdir,
|
||||
)
|
||||
result = script.pip(
|
||||
'install', 'script.wheel2a==0.1', '--no-index',
|
||||
|
@ -320,13 +337,15 @@ def test_install_from_wheel_with_legacy(script, data, tmpdir):
|
|||
assert legacy_file2 in result.files_created
|
||||
|
||||
|
||||
def test_install_from_wheel_no_setuptools_entrypoint(script, data, tmpdir):
|
||||
def test_install_from_wheel_no_setuptools_entrypoint(
|
||||
script, shared_data, tmpdir
|
||||
):
|
||||
"""
|
||||
Test that when we generate scripts, any existing setuptools wrappers in
|
||||
the wheel are skipped.
|
||||
"""
|
||||
shutil.copy(
|
||||
data.packages / "script.wheel1-0.1-py2.py3-none-any.whl", tmpdir
|
||||
shared_data.packages / "script.wheel1-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
result = script.pip(
|
||||
'install', 'script.wheel1==0.1', '--no-index',
|
||||
|
@ -347,13 +366,13 @@ def test_install_from_wheel_no_setuptools_entrypoint(script, data, tmpdir):
|
|||
assert wrapper_helper not in result.files_created
|
||||
|
||||
|
||||
def test_skipping_setuptools_doesnt_skip_legacy(script, data, tmpdir):
|
||||
def test_skipping_setuptools_doesnt_skip_legacy(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing scripts (legacy scripts are preserved even when we skip
|
||||
setuptools wrappers)
|
||||
"""
|
||||
shutil.copy(
|
||||
data.packages / "script.wheel2-0.1-py2.py3-none-any.whl", tmpdir
|
||||
shared_data.packages / "script.wheel2-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
result = script.pip(
|
||||
'install', 'script.wheel2==0.1', '--no-index',
|
||||
|
@ -369,12 +388,12 @@ def test_skipping_setuptools_doesnt_skip_legacy(script, data, tmpdir):
|
|||
assert wrapper_helper not in result.files_created
|
||||
|
||||
|
||||
def test_install_from_wheel_gui_entrypoint(script, data, tmpdir):
|
||||
def test_install_from_wheel_gui_entrypoint(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing scripts (gui entry points are generated)
|
||||
"""
|
||||
shutil.copy(
|
||||
data.packages / "script.wheel3-0.1-py2.py3-none-any.whl", tmpdir
|
||||
shared_data.packages / "script.wheel3-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
result = script.pip(
|
||||
'install', 'script.wheel3==0.1', '--no-index',
|
||||
|
@ -387,11 +406,13 @@ def test_install_from_wheel_gui_entrypoint(script, data, tmpdir):
|
|||
assert wrapper_file in result.files_created
|
||||
|
||||
|
||||
def test_wheel_compiles_pyc(script, data, tmpdir):
|
||||
def test_wheel_compiles_pyc(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing from wheel with --compile on
|
||||
"""
|
||||
shutil.copy(data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir)
|
||||
shutil.copy(
|
||||
shared_data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
script.pip(
|
||||
"install", "--compile", "simple.dist==0.1", "--no-index",
|
||||
"--find-links", tmpdir,
|
||||
|
@ -409,11 +430,13 @@ def test_wheel_compiles_pyc(script, data, tmpdir):
|
|||
assert any(exists)
|
||||
|
||||
|
||||
def test_wheel_no_compiles_pyc(script, data, tmpdir):
|
||||
def test_wheel_no_compiles_pyc(script, shared_data, tmpdir):
|
||||
"""
|
||||
Test installing from wheel with --compile on
|
||||
"""
|
||||
shutil.copy(data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir)
|
||||
shutil.copy(
|
||||
shared_data.packages / "simple.dist-0.1-py2.py3-none-any.whl", tmpdir
|
||||
)
|
||||
script.pip(
|
||||
"install", "--no-compile", "simple.dist==0.1", "--no-index",
|
||||
"--find-links", tmpdir,
|
||||
|
|
Loading…
Reference in a new issue