test_install_package_with_target: No network

and also fix intermittent failures reported in
https://github.com/pypa/pip/issues/2580
This commit is contained in:
Marc Abramowitz 2015-03-19 13:49:58 -07:00
parent 3b14a4f0e5
commit 291bb12d07
6 changed files with 31 additions and 17 deletions

Binary file not shown.

Binary file not shown.

View 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

View 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'],
)

View File

@ -0,0 +1,3 @@
def main():
"""Entry point for the application script"""
print("Call your main application code here")

View File

@ -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):