mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Merge pull request #2583 from msabramo/test_install_package_with_target
test_install_package_with_target: No network
This commit is contained in:
commit
df785551ce
BIN
tests/data/packages/singlemodule-0.0.0.tar.gz
Normal file
BIN
tests/data/packages/singlemodule-0.0.0.tar.gz
Normal file
Binary file not shown.
BIN
tests/data/packages/singlemodule-0.0.1.tar.gz
Normal file
BIN
tests/data/packages/singlemodule-0.0.1.tar.gz
Normal file
Binary file not shown.
5
tests/data/src/singlemodule/setup.cfg
Normal file
5
tests/data/src/singlemodule/setup.cfg
Normal file
|
@ -0,0 +1,5 @@
|
|||
[bdist_wheel]
|
||||
# This flag says that the code is written to work on both Python 2 and Python
|
||||
# 3. If at all possible, it is good practice to do this. If you cannot, you
|
||||
# will need to generate wheels for each Python version that you support.
|
||||
universal=1
|
9
tests/data/src/singlemodule/setup.py
Normal file
9
tests/data/src/singlemodule/setup.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from setuptools import setup
|
||||
|
||||
|
||||
setup(
|
||||
name="singlemodule",
|
||||
version='0.0.1',
|
||||
description="A sample Python project with a single module",
|
||||
py_modules=['singlemodule'],
|
||||
)
|
3
tests/data/src/singlemodule/singlemodule.py
Normal file
3
tests/data/src/singlemodule/singlemodule.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
def main():
|
||||
"""Entry point for the application script"""
|
||||
print("Call your main application code here")
|
|
@ -531,43 +531,40 @@ def test_install_package_which_contains_dev_in_name(script):
|
|||
assert egg_info_folder in result.files_created, str(result)
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_install_package_with_target(script):
|
||||
"""
|
||||
Test installing a package using pip install --target
|
||||
"""
|
||||
target_dir = script.scratch_path / 'target'
|
||||
result = script.pip('install', '-t', target_dir, "initools==0.1")
|
||||
assert Path('scratch') / 'target' / 'initools' in result.files_created, (
|
||||
result = script.pip_install_local('-t', target_dir, "simple==1.0")
|
||||
assert Path('scratch') / 'target' / 'simple' in result.files_created, (
|
||||
str(result)
|
||||
)
|
||||
|
||||
# Test repeated call without --upgrade, no files should have changed
|
||||
result = script.pip('install', '-t', target_dir, "initools==0.1")
|
||||
assert not Path('scratch') / 'target' / 'initools' in result.files_updated
|
||||
result = script.pip_install_local('-t', target_dir, "simple==1.0")
|
||||
assert not Path('scratch') / 'target' / 'simple' in result.files_updated
|
||||
|
||||
# Test upgrade call, check that new version is installed
|
||||
result = script.pip('install', '--upgrade', '-t',
|
||||
target_dir, "initools==0.2")
|
||||
assert Path('scratch') / 'target' / 'initools' in result.files_updated, (
|
||||
result = script.pip_install_local('--upgrade', '-t',
|
||||
target_dir, "simple==2.0")
|
||||
assert Path('scratch') / 'target' / 'simple' in result.files_updated, (
|
||||
str(result)
|
||||
)
|
||||
egg_folder = (
|
||||
Path('scratch') / 'target' / 'INITools-0.2-py%s.egg-info' % pyversion)
|
||||
Path('scratch') / 'target' / 'simple-2.0-py%s.egg-info' % pyversion)
|
||||
assert egg_folder in result.files_created, (
|
||||
str(result)
|
||||
)
|
||||
|
||||
# Test install and upgrade of single-module package
|
||||
result = script.pip('install', '-t', target_dir, 'six')
|
||||
assert Path('scratch') / 'target' / 'six.py' in result.files_created, (
|
||||
str(result)
|
||||
)
|
||||
result = script.pip_install_local('-t', target_dir, 'singlemodule==0.0.0')
|
||||
singlemodule_py = Path('scratch') / 'target' / 'singlemodule.py'
|
||||
assert singlemodule_py in result.files_created, str(result)
|
||||
|
||||
result = script.pip('install', '-t', target_dir, '--upgrade', 'six')
|
||||
assert Path('scratch') / 'target' / 'six.py' in result.files_updated, (
|
||||
str(result)
|
||||
)
|
||||
result = script.pip_install_local('-t', target_dir, 'singlemodule==0.0.1',
|
||||
'--upgrade')
|
||||
assert singlemodule_py in result.files_updated, str(result)
|
||||
|
||||
|
||||
def test_install_package_with_root(script, data):
|
||||
|
|
Loading…
Reference in a new issue