mirror of https://github.com/pypa/pip
Isolate the tests from the shared data directory
This commit is contained in:
parent
bacf3a0091
commit
487925ea3f
|
@ -2,19 +2,17 @@ import zipfile
|
|||
import textwrap
|
||||
from os.path import abspath, exists, join
|
||||
from pip.download import path_to_url2
|
||||
from tests.lib import tests_data
|
||||
from tests.lib.path import Path
|
||||
from tests.lib.local_repos import local_checkout
|
||||
|
||||
|
||||
def test_create_bundle(script, tmpdir):
|
||||
def test_create_bundle(script, tmpdir, data):
|
||||
"""
|
||||
Test making a bundle. We'll grab one package from the filesystem
|
||||
(the FSPkg dummy package), one from vcs (initools) and one from an
|
||||
index (pip itself).
|
||||
|
||||
"""
|
||||
fspkg = path_to_url2(Path(tests_data)/'packages'/'FSPkg')
|
||||
fspkg = path_to_url2(data.packages/'FSPkg')
|
||||
script.pip('install', '-e', fspkg)
|
||||
pkg_lines = textwrap.dedent('''\
|
||||
-e %s
|
||||
|
@ -32,7 +30,7 @@ def test_create_bundle(script, tmpdir):
|
|||
assert 'build/pip/' in files
|
||||
|
||||
|
||||
def test_cleanup_after_create_bundle(script, tmpdir):
|
||||
def test_cleanup_after_create_bundle(script, tmpdir, data):
|
||||
"""
|
||||
Test clean up after making a bundle. Make sure (build|src)-bundle/ dirs are removed but not src/.
|
||||
|
||||
|
@ -49,7 +47,7 @@ def test_cleanup_after_create_bundle(script, tmpdir):
|
|||
assert exists(src), "expected src/ dir doesn't exist: %s" % src
|
||||
|
||||
# Make the bundle.
|
||||
fspkg = 'file://%s/FSPkg' %join(tests_data, 'packages')
|
||||
fspkg = path_to_url2(data.packages/'FSPkg')
|
||||
pkg_lines = textwrap.dedent('''\
|
||||
-e %s
|
||||
-e %s#egg=initools-dev
|
||||
|
|
|
@ -7,7 +7,7 @@ from os.path import abspath, join, curdir, pardir
|
|||
import pytest
|
||||
|
||||
from pip.util import rmtree
|
||||
from tests.lib import tests_data, pyversion, find_links
|
||||
from tests.lib import pyversion
|
||||
from tests.lib.local_repos import local_checkout
|
||||
from tests.lib.path import Path
|
||||
|
||||
|
@ -196,11 +196,11 @@ def test_vcs_url_urlquote_normalization(script, tmpdir):
|
|||
assert 'pip-log.txt' not in result.files_created, result.files_created['pip-log.txt'].bytes
|
||||
|
||||
|
||||
def test_install_from_local_directory(script):
|
||||
def test_install_from_local_directory(script, data):
|
||||
"""
|
||||
Test installing from a local directory.
|
||||
"""
|
||||
to_install = abspath(join(tests_data, 'packages', 'FSPkg'))
|
||||
to_install = data.packages.join("FSPkg")
|
||||
result = script.pip('install', to_install, expect_error=False)
|
||||
fspkg_folder = script.site_packages/'fspkg'
|
||||
egg_info_folder = script.site_packages/'FSPkg-0.1dev-py%s.egg-info' % pyversion
|
||||
|
@ -208,31 +208,31 @@ def test_install_from_local_directory(script):
|
|||
assert egg_info_folder in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_from_local_directory_with_no_setup_py(script):
|
||||
def test_install_from_local_directory_with_no_setup_py(script, data):
|
||||
"""
|
||||
Test installing from a local directory with no 'setup.py'.
|
||||
"""
|
||||
result = script.pip('install', tests_data, expect_error=True)
|
||||
result = script.pip('install', data.root, expect_error=True)
|
||||
assert len(result.files_created) == 1, result.files_created
|
||||
assert 'pip-log.txt' in result.files_created, result.files_created
|
||||
assert "is not installable. File 'setup.py' not found." in result.stdout
|
||||
|
||||
|
||||
def test_editable_install_from_local_directory_with_no_setup_py(script):
|
||||
def test_editable_install_from_local_directory_with_no_setup_py(script, data):
|
||||
"""
|
||||
Test installing from a local directory with no 'setup.py'.
|
||||
"""
|
||||
result = script.pip('install', '-e', tests_data, expect_error=True)
|
||||
result = script.pip('install', '-e', data.root, expect_error=True)
|
||||
assert len(result.files_created) == 1, result.files_created
|
||||
assert 'pip-log.txt' in result.files_created, result.files_created
|
||||
assert "is not installable. File 'setup.py' not found." in result.stdout
|
||||
|
||||
|
||||
def test_install_as_egg(script):
|
||||
def test_install_as_egg(script, data):
|
||||
"""
|
||||
Test installing as egg, instead of flat install.
|
||||
"""
|
||||
to_install = abspath(join(tests_data, 'packages', 'FSPkg'))
|
||||
to_install = data.packages.join("FSPkg")
|
||||
result = script.pip('install', to_install, '--egg', expect_error=False)
|
||||
fspkg_folder = script.site_packages/'fspkg'
|
||||
egg_folder = script.site_packages/'FSPkg-0.1dev-py%s.egg' % pyversion
|
||||
|
@ -241,11 +241,11 @@ def test_install_as_egg(script):
|
|||
assert join(egg_folder, 'fspkg') in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_curdir(script):
|
||||
def test_install_curdir(script, data):
|
||||
"""
|
||||
Test installing current directory ('.').
|
||||
"""
|
||||
run_from = abspath(join(tests_data, 'packages', 'FSPkg'))
|
||||
run_from = data.packages.join("FSPkg")
|
||||
# Python 2.4 Windows balks if this exists already
|
||||
egg_info = join(run_from, "FSPkg.egg-info")
|
||||
if os.path.isdir(egg_info):
|
||||
|
@ -257,11 +257,11 @@ def test_install_curdir(script):
|
|||
assert egg_info_folder in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_pardir(script):
|
||||
def test_install_pardir(script, data):
|
||||
"""
|
||||
Test installing parent directory ('..').
|
||||
"""
|
||||
run_from = abspath(join(tests_data, 'packages', 'FSPkg', 'fspkg'))
|
||||
run_from = data.packages.join("FSPkg", "fspkg")
|
||||
result = script.pip('install', pardir, cwd=run_from, expect_error=False)
|
||||
fspkg_folder = script.site_packages/'fspkg'
|
||||
egg_info_folder = script.site_packages/'FSPkg-0.1dev-py%s.egg-info' % pyversion
|
||||
|
@ -278,19 +278,18 @@ def test_install_global_option(script):
|
|||
assert '0.1\n' in result.stdout
|
||||
|
||||
|
||||
def test_install_with_pax_header(script):
|
||||
def test_install_with_pax_header(script, data):
|
||||
"""
|
||||
test installing from a tarball with pax header for python<2.6
|
||||
"""
|
||||
run_from = abspath(join(tests_data, 'packages'))
|
||||
script.pip('install', 'paxpkg.tar.bz2', cwd=run_from)
|
||||
script.pip('install', 'paxpkg.tar.bz2', cwd=data.packages)
|
||||
|
||||
|
||||
def test_install_with_hacked_egg_info(script):
|
||||
def test_install_with_hacked_egg_info(script, data):
|
||||
"""
|
||||
test installing a package which defines its own egg_info class
|
||||
"""
|
||||
run_from = abspath(join(tests_data, 'packages', 'HackedEggInfo'))
|
||||
run_from = data.packages.join("HackedEggInfo")
|
||||
result = script.pip('install', '.', cwd=run_from)
|
||||
assert 'Successfully installed hackedegginfo\n' in result.stdout
|
||||
|
||||
|
@ -393,12 +392,12 @@ def test_install_package_with_target(script):
|
|||
assert Path('scratch')/'target'/'initools' in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_package_with_root(script):
|
||||
def test_install_package_with_root(script, data):
|
||||
"""
|
||||
Test installing a package using pip install --root
|
||||
"""
|
||||
root_dir = script.scratch_path/'root'
|
||||
result = script.pip('install', '--root', root_dir, '-f', find_links, '--no-index', 'simple==1.0')
|
||||
result = script.pip('install', '--root', root_dir, '-f', data.find_links, '--no-index', 'simple==1.0')
|
||||
normal_install_path = script.base_path / script.site_packages / 'simple-1.0-py%s.egg-info' % pyversion
|
||||
#use distutils to change the root exactly how the --root option does it
|
||||
from distutils.util import change_root
|
||||
|
@ -408,7 +407,7 @@ def test_install_package_with_root(script):
|
|||
|
||||
# skip on win/py3 for now, see issue #782
|
||||
@pytest.mark.skipif("sys.platform == 'win32' and sys.version_info >= (3,)")
|
||||
def test_install_package_that_emits_unicode(script):
|
||||
def test_install_package_that_emits_unicode(script, data):
|
||||
"""
|
||||
Install a package with a setup.py that emits UTF-8 output and then fails.
|
||||
This works fine in Python 2, but fails in Python 3 with:
|
||||
|
@ -423,13 +422,13 @@ def test_install_package_that_emits_unicode(script):
|
|||
|
||||
Refs https://github.com/pypa/pip/issues/326
|
||||
"""
|
||||
to_install = os.path.abspath(os.path.join(tests_data, 'packages', 'BrokenEmitsUTF8'))
|
||||
to_install = data.packages.join("BrokenEmitsUTF8")
|
||||
result = script.pip('install', to_install, expect_error=True, expect_temp=True, quiet=True)
|
||||
assert 'FakeError: this package designed to fail on install' in result.stdout
|
||||
assert 'UnicodeDecodeError' not in result.stdout
|
||||
|
||||
|
||||
def test_url_req_case_mismatch(script):
|
||||
def test_url_req_case_mismatch(script, data):
|
||||
"""
|
||||
tar ball url requirements (with no egg fragment), that happen to have upper case project names,
|
||||
should be considered equal to later requirements that reference the project name using lower case.
|
||||
|
@ -437,8 +436,8 @@ def test_url_req_case_mismatch(script):
|
|||
tests/packages contains Upper-1.0.tar.gz and Upper-2.0.tar.gz
|
||||
'requiresupper' has install_requires = ['upper']
|
||||
"""
|
||||
Upper = os.path.join(find_links, 'Upper-1.0.tar.gz')
|
||||
result = script.pip('install', '--no-index', '-f', find_links, Upper, 'requiresupper')
|
||||
Upper = os.path.join(data.find_links, 'Upper-1.0.tar.gz')
|
||||
result = script.pip('install', '--no-index', '-f', data.find_links, Upper, 'requiresupper')
|
||||
|
||||
#only Upper-1.0.tar.gz should get installed.
|
||||
egg_folder = script.site_packages / 'Upper-1.0-py%s.egg-info' % pyversion
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import os
|
||||
|
||||
from tests.lib import packages
|
||||
|
||||
|
||||
def test_install_pybundle(script):
|
||||
def test_install_pybundle(script, data):
|
||||
"""
|
||||
Test intalling a *.pybundle file
|
||||
"""
|
||||
result = script.pip_install_local(os.path.join(packages, 'simplebundle.pybundle'), expect_temp=True)
|
||||
result = script.pip_install_local(
|
||||
data.packages.join("simplebundle.pybundle"),
|
||||
expect_temp=True,
|
||||
)
|
||||
result.assert_installed('simple', editable=False)
|
||||
result.assert_installed('simple2', editable=False)
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import os
|
||||
import textwrap
|
||||
|
||||
from os.path import abspath, exists, join
|
||||
from tests.lib import tests_data, find_links
|
||||
|
||||
from tests.lib.local_repos import local_checkout
|
||||
from tests.lib.path import Path
|
||||
from pip.locations import write_delete_marker_file
|
||||
from pip.status_codes import PREVIOUS_BUILD_DIR_ERROR
|
||||
|
||||
|
||||
def test_cleanup_after_install(script):
|
||||
def test_cleanup_after_install(script, data):
|
||||
"""
|
||||
Test clean up after installing a package.
|
||||
"""
|
||||
script.pip('install', '--no-index', '--find-links=%s' % find_links, 'simple')
|
||||
script.pip('install', '--no-index', '--find-links=%s' % data.find_links, 'simple')
|
||||
build = script.venv_path/"build"
|
||||
src = script.venv_path/"src"
|
||||
assert not exists(build), "build/ dir still exists: %s" % build
|
||||
|
@ -20,11 +20,11 @@ def test_cleanup_after_install(script):
|
|||
script.assert_no_temp()
|
||||
|
||||
|
||||
def test_no_clean_option_blocks_cleaning_after_install(script):
|
||||
def test_no_clean_option_blocks_cleaning_after_install(script, data):
|
||||
"""
|
||||
Test --no-clean option blocks cleaning after install
|
||||
"""
|
||||
result = script.pip('install', '--no-clean', '--no-index', '--find-links=%s' % find_links, 'simple')
|
||||
result = script.pip('install', '--no-clean', '--no-index', '--find-links=%s' % data.find_links, 'simple')
|
||||
build = script.venv_path/'build'/'simple'
|
||||
assert exists(build), "build/simple should still exist %s" % str(result)
|
||||
|
||||
|
@ -46,12 +46,11 @@ def test_cleanup_after_install_editable_from_hg(script, tmpdir):
|
|||
script.assert_no_temp()
|
||||
|
||||
|
||||
def test_cleanup_after_install_from_local_directory(script):
|
||||
def test_cleanup_after_install_from_local_directory(script, data):
|
||||
"""
|
||||
Test clean up after installing from a local directory.
|
||||
|
||||
"""
|
||||
to_install = abspath(join(tests_data, 'packages', 'FSPkg'))
|
||||
to_install = data.packages.join("FSPkg")
|
||||
script.pip('install', to_install, expect_error=False)
|
||||
build = script.venv_path/'build'
|
||||
src = script.venv_path/'src'
|
||||
|
@ -71,7 +70,7 @@ def test_no_install_and_download_should_not_leave_build_dir(script):
|
|||
assert not os.path.exists(script.venv_path/'/build'), "build/ dir should be deleted"
|
||||
|
||||
|
||||
def test_cleanup_req_satisifed_no_name(script):
|
||||
def test_cleanup_req_satisifed_no_name(script, data):
|
||||
"""
|
||||
Test cleanup when req is already satisfied, and req has no 'name'
|
||||
"""
|
||||
|
@ -80,8 +79,7 @@ def test_cleanup_req_satisifed_no_name(script):
|
|||
#2 examples of reqs that would do this
|
||||
# 1) https://bitbucket.org/ianb/initools/get/tip.zip
|
||||
# 2) parent-0.1.tar.gz
|
||||
|
||||
dist = abspath(join(tests_data, 'packages', 'parent-0.1.tar.gz'))
|
||||
dist = data.packages.join("parent-0.1.tar.gz")
|
||||
result = script.pip('install', dist)
|
||||
result = script.pip('install', dist)
|
||||
build = script.venv_path/'build'
|
||||
|
@ -103,29 +101,29 @@ def test_download_should_not_delete_existing_build_dir(script):
|
|||
assert ['somefile.txt'] == os.listdir(script.venv_path/'build')
|
||||
|
||||
|
||||
def test_cleanup_after_install_exception(script):
|
||||
def test_cleanup_after_install_exception(script, data):
|
||||
"""
|
||||
Test clean up after a 'setup.py install' exception.
|
||||
"""
|
||||
#broken==0.2broken fails during install; see packages readme file
|
||||
result = script.pip('install', '-f', find_links, '--no-index', 'broken==0.2broken', expect_error=True)
|
||||
result = script.pip('install', '-f', data.find_links, '--no-index', 'broken==0.2broken', expect_error=True)
|
||||
build = script.venv_path/'build'
|
||||
assert not exists(build), "build/ dir still exists: %s" % result.stdout
|
||||
script.assert_no_temp()
|
||||
|
||||
|
||||
def test_cleanup_after_egg_info_exception(script):
|
||||
def test_cleanup_after_egg_info_exception(script, data):
|
||||
"""
|
||||
Test clean up after a 'setup.py egg_info' exception.
|
||||
"""
|
||||
#brokenegginfo fails during egg_info; see packages readme file
|
||||
result = script.pip('install', '-f', find_links, '--no-index', 'brokenegginfo==0.1', expect_error=True)
|
||||
result = script.pip('install', '-f', data.find_links, '--no-index', 'brokenegginfo==0.1', expect_error=True)
|
||||
build = script.venv_path/'build'
|
||||
assert not exists(build), "build/ dir still exists: %s" % result.stdout
|
||||
script.assert_no_temp()
|
||||
|
||||
|
||||
def test_cleanup_prevented_upon_build_dir_exception(script):
|
||||
def test_cleanup_prevented_upon_build_dir_exception(script, data):
|
||||
"""
|
||||
Test no cleanup occurs after a PreviousBuildDirError
|
||||
"""
|
||||
|
@ -133,7 +131,7 @@ def test_cleanup_prevented_upon_build_dir_exception(script):
|
|||
os.makedirs(build)
|
||||
write_delete_marker_file(script.venv_path/'build')
|
||||
build.join("setup.py").write("#")
|
||||
result = script.pip('install', '-f', find_links, '--no-index', 'simple', expect_error=True)
|
||||
result = script.pip('install', '-f', data.find_links, '--no-index', 'simple', expect_error=True)
|
||||
|
||||
assert result.returncode == PREVIOUS_BUILD_DIR_ERROR
|
||||
assert "pip can't proceed" in result.stdout, result.stdout
|
||||
|
|
|
@ -3,7 +3,7 @@ Tests for compatibility workarounds.
|
|||
|
||||
"""
|
||||
import os
|
||||
from tests.lib import tests_data, pyversion, assert_all_changes
|
||||
from tests.lib import pyversion, assert_all_changes
|
||||
|
||||
|
||||
def test_debian_egg_name_workaround(script):
|
||||
|
@ -43,11 +43,11 @@ def test_debian_egg_name_workaround(script):
|
|||
assert_all_changes(result, result2, [script.venv/'build', 'cache'])
|
||||
|
||||
|
||||
def test_setup_py_with_dos_line_endings(script):
|
||||
def test_setup_py_with_dos_line_endings(script, data):
|
||||
"""
|
||||
It doesn't choke on a setup.py file that uses DOS line endings (\\r\\n).
|
||||
|
||||
Refs https://github.com/pypa/pip/issues/237
|
||||
"""
|
||||
to_install = os.path.abspath(os.path.join(tests_data, 'packages', 'LineEndings'))
|
||||
to_install = data.packages.join("LineEndings")
|
||||
script.pip('install', to_install, expect_error=False)
|
||||
|
|
|
@ -2,8 +2,6 @@ import os
|
|||
import tempfile
|
||||
import textwrap
|
||||
|
||||
from tests.lib import find_links
|
||||
|
||||
|
||||
def test_options_from_env_vars(script):
|
||||
"""
|
||||
|
|
|
@ -3,10 +3,10 @@ import textwrap
|
|||
|
||||
from pip.backwardcompat import urllib
|
||||
|
||||
from tests.lib import pyversion, tests_data, path_to_url, packages
|
||||
from tests.lib import pyversion, path_to_url
|
||||
|
||||
|
||||
def test_find_links_relative_path(script):
|
||||
def test_find_links_relative_path(script, data):
|
||||
"""Test find-links as a relative path."""
|
||||
result = script.pip(
|
||||
'install',
|
||||
|
@ -14,46 +14,47 @@ def test_find_links_relative_path(script):
|
|||
'--no-index',
|
||||
'--find-links',
|
||||
'packages/',
|
||||
cwd=tests_data)
|
||||
cwd=data.root,
|
||||
)
|
||||
egg_info_folder = script.site_packages / 'parent-0.1-py%s.egg-info' % pyversion
|
||||
initools_folder = script.site_packages / 'parent'
|
||||
assert egg_info_folder in result.files_created, str(result)
|
||||
assert initools_folder in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_find_links_requirements_file_relative_path(script):
|
||||
def test_find_links_requirements_file_relative_path(script, data):
|
||||
"""Test find-links as a relative path to a reqs file."""
|
||||
script.scratch_path.join("test-req.txt").write(textwrap.dedent("""
|
||||
--no-index
|
||||
--find-links=%s
|
||||
parent==0.1
|
||||
""" % packages))
|
||||
""" % data.packages))
|
||||
result = script.pip(
|
||||
'install',
|
||||
'-r',
|
||||
script.scratch_path / "test-req.txt",
|
||||
cwd=tests_data)
|
||||
cwd=data.root,
|
||||
)
|
||||
egg_info_folder = script.site_packages / 'parent-0.1-py%s.egg-info' % pyversion
|
||||
initools_folder = script.site_packages / 'parent'
|
||||
assert egg_info_folder in result.files_created, str(result)
|
||||
assert initools_folder in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_from_file_index_hash_link(script):
|
||||
def test_install_from_file_index_hash_link(script, data):
|
||||
"""
|
||||
Test that a pkg can be installed from a file:// index using a link with a hash
|
||||
"""
|
||||
index_url = path_to_url(os.path.join(tests_data, 'indexes', 'simple'))
|
||||
result = script.pip('install', '-i', index_url, 'simple==1.0')
|
||||
result = script.pip('install', '-i', data.index_url(), 'simple==1.0')
|
||||
egg_info_folder = script.site_packages / 'simple-1.0-py%s.egg-info' % pyversion
|
||||
assert egg_info_folder in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_file_index_url_quoting(script):
|
||||
def test_file_index_url_quoting(script, data):
|
||||
"""
|
||||
Test url quoting of file index url with a space
|
||||
"""
|
||||
index_url = path_to_url(os.path.join(tests_data, 'indexes', urllib.quote('in dex')))
|
||||
index_url = data.index_url(urllib.quote("in dex"))
|
||||
result = script.pip('install', '-vvv', '--index-url', index_url, 'simple', expect_error=False)
|
||||
assert (script.site_packages/'simple') in result.files_created, str(result.stdout)
|
||||
assert (script.site_packages/'simple-1.0-py%s.egg-info' % pyversion) in result.files_created, str(result)
|
||||
|
|
|
@ -8,7 +8,7 @@ from mock import patch
|
|||
from pip.backwardcompat import urllib
|
||||
from pip.req import Requirements, parse_editable, parse_requirements
|
||||
|
||||
from tests.lib import pyversion, tests_data, path_to_url, find_links
|
||||
from tests.lib import pyversion, path_to_url
|
||||
from tests.lib.local_repos import local_checkout
|
||||
from tests.lib.path import Path
|
||||
|
||||
|
@ -45,12 +45,12 @@ def test_schema_check_in_requirements_file(script):
|
|||
script.pip("install", "-vvv", "-r", script.scratch_path / "file-egg-req.txt")
|
||||
|
||||
|
||||
def test_relative_requirements_file(script):
|
||||
def test_relative_requirements_file(script, data):
|
||||
"""
|
||||
Test installing from a requirements file with a relative path with an egg= definition..
|
||||
|
||||
"""
|
||||
url = path_to_url(os.path.join(tests_data, 'packages', '..', 'packages', 'FSPkg')) + '#egg=FSPkg'
|
||||
url = path_to_url(os.path.join(data.root, "packages", "..", "packages", "FSPkg")) + '#egg=FSPkg'
|
||||
script.scratch_path.join("file-egg-req.txt").write(textwrap.dedent("""\
|
||||
%s
|
||||
""" % url))
|
||||
|
@ -79,14 +79,14 @@ def test_multiple_requirements_files(script, tmpdir):
|
|||
assert script.venv/'src'/'initools' in result.files_created
|
||||
|
||||
|
||||
def test_respect_order_in_requirements_file(script):
|
||||
def test_respect_order_in_requirements_file(script, data):
|
||||
script.scratch_path.join("frameworks-req.txt").write(textwrap.dedent("""\
|
||||
parent
|
||||
child
|
||||
simple
|
||||
"""))
|
||||
|
||||
result = script.pip('install', '--no-index', '-f', find_links, '-r', script.scratch_path / 'frameworks-req.txt')
|
||||
result = script.pip('install', '--no-index', '-f', data.find_links, '-r', script.scratch_path / 'frameworks-req.txt')
|
||||
|
||||
downloaded = [line for line in result.stdout.split('\n')
|
||||
if 'Downloading/unpacking' in line]
|
||||
|
@ -99,8 +99,8 @@ def test_respect_order_in_requirements_file(script):
|
|||
'be "simple" but was "%s"' % downloaded[2]
|
||||
|
||||
|
||||
def test_install_local_editable_with_extras(script):
|
||||
to_install = os.path.abspath(os.path.join(tests_data, 'packages', 'LocalExtras'))
|
||||
def test_install_local_editable_with_extras(script, data):
|
||||
to_install = data.packages.join("LocalExtras")
|
||||
res = script.pip('install', '-e', to_install + '[bar]', expect_error=False)
|
||||
assert script.site_packages/'easy-install.pth' in res.files_updated, str(result)
|
||||
assert script.site_packages/'LocalExtras.egg-link' in res.files_created, str(result)
|
||||
|
|
|
@ -6,7 +6,7 @@ from os.path import join
|
|||
|
||||
import pytest
|
||||
|
||||
from tests.lib import (assert_all_changes, src_folder, pyversion, find_links,
|
||||
from tests.lib import (assert_all_changes, src_folder, pyversion,
|
||||
_create_test_package, _change_test_package_version)
|
||||
from tests.lib.local_repos import local_checkout
|
||||
|
||||
|
@ -44,13 +44,13 @@ def test_upgrade_if_requested(script):
|
|||
assert script.site_packages/'INITools-0.1-py%s.egg-info' % pyversion not in result.files_created
|
||||
|
||||
|
||||
def test_upgrade_with_newest_already_installed(script):
|
||||
def test_upgrade_with_newest_already_installed(script, data):
|
||||
"""
|
||||
If the newest version of a package is already installed, the package should
|
||||
not be reinstalled and the user should be informed.
|
||||
"""
|
||||
script.pip('install', '-f', find_links, '--no-index', 'simple')
|
||||
result = script.pip('install', '--upgrade', '-f', find_links, '--no-index', 'simple')
|
||||
script.pip('install', '-f', data.find_links, '--no-index', 'simple')
|
||||
result = script.pip('install', '--upgrade', '-f', data.find_links, '--no-index', 'simple')
|
||||
assert not result.files_created, 'simple upgraded when it should not have'
|
||||
assert 'already up-to-date' in result.stdout, result.stdout
|
||||
|
||||
|
@ -129,15 +129,15 @@ def test_upgrade_from_reqs_file(script):
|
|||
assert_all_changes(install_result, uninstall_result, [script.venv/'build', 'cache', script.scratch/'test-req.txt'])
|
||||
|
||||
|
||||
def test_uninstall_rollback(script):
|
||||
def test_uninstall_rollback(script, data):
|
||||
"""
|
||||
Test uninstall-rollback (using test package with a setup.py
|
||||
crafted to fail on install).
|
||||
|
||||
"""
|
||||
result = script.pip('install', '-f', find_links, '--no-index', 'broken==0.1')
|
||||
result = script.pip('install', '-f', data.find_links, '--no-index', 'broken==0.1')
|
||||
assert script.site_packages / 'broken.py' in result.files_created, list(result.files_created.keys())
|
||||
result2 = script.pip('install', '-f', find_links, '--no-index', 'broken==0.2broken', expect_error=True)
|
||||
result2 = script.pip('install', '-f', data.find_links, '--no-index', 'broken==0.2broken', expect_error=True)
|
||||
assert result2.returncode == 1, str(result2)
|
||||
assert script.run('python', '-c', "import broken; print(broken.VERSION)").stdout == '0.1\n'
|
||||
assert_all_changes(result.files_after, result2, [script.venv/'build', 'pip-log.txt'])
|
||||
|
@ -224,44 +224,44 @@ class TestUpgradeSetuptools(object):
|
|||
self.script.run(self.ve_bin/'python', 'setup.py', 'install', cwd=src_folder, expect_stderr=True)
|
||||
|
||||
@pytest.mark.skipif("sys.version_info >= (3,0)")
|
||||
def test_py2_from_setuptools_6_to_setuptools_7(self, script):
|
||||
def test_py2_from_setuptools_6_to_setuptools_7(self, script, data):
|
||||
self.prep_ve(script, '1.9.1')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % data.find_links, '-U', 'setuptools')
|
||||
assert "Found existing installation: setuptools 0.6c11" in result.stdout
|
||||
result = self.script.run(self.ve_bin/'pip', 'list')
|
||||
"setuptools (0.9.8)" in result.stdout
|
||||
|
||||
def test_py2_py3_from_distribute_6_to_setuptools_7(self, script):
|
||||
def test_py2_py3_from_distribute_6_to_setuptools_7(self, script, data):
|
||||
self.prep_ve(script, '1.9.1', distribute=True)
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % data.find_links, '-U', 'setuptools')
|
||||
assert "Found existing installation: distribute 0.6.34" in result.stdout
|
||||
result = self.script.run(self.ve_bin/'pip', 'list')
|
||||
"setuptools (0.9.8)" in result.stdout
|
||||
"distribute (0.7.3)" in result.stdout
|
||||
|
||||
def test_from_setuptools_7_to_setuptools_7(self, script):
|
||||
def test_from_setuptools_7_to_setuptools_7(self, script, data):
|
||||
self.prep_ve(script, '1.10')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % data.find_links, '-U', 'setuptools')
|
||||
assert "Found existing installation: setuptools 0.9.7" in result.stdout
|
||||
result = self.script.run(self.ve_bin/'pip', 'list')
|
||||
"setuptools (0.9.8)" in result.stdout
|
||||
|
||||
def test_from_setuptools_7_to_setuptools_7_using_wheel(self, script):
|
||||
def test_from_setuptools_7_to_setuptools_7_using_wheel(self, script, data):
|
||||
self.prep_ve(script, '1.10')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--use-wheel', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--use-wheel', '--no-index', '--find-links=%s' % data.find_links, '-U', 'setuptools')
|
||||
assert "Found existing installation: setuptools 0.9.7" in result.stdout
|
||||
assert 'setuptools-0.9.8.dist-info' in str(result.files_created) #only wheels use dist-info
|
||||
result = self.script.run(self.ve_bin/'pip', 'list')
|
||||
"setuptools (0.9.8)" in result.stdout
|
||||
|
||||
def test_from_setuptools_7_to_setuptools_7_with_distribute_7_installed(self, script):
|
||||
def test_from_setuptools_7_to_setuptools_7_with_distribute_7_installed(self, script, data):
|
||||
self.prep_ve(script, '1.9.1', distribute=True)
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, 'setuptools==0.9.6')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % data.find_links, '-U', 'setuptools')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % data.find_links, 'setuptools==0.9.6')
|
||||
result = self.script.run(self.ve_bin/'pip', 'list')
|
||||
"setuptools (0.9.6)" in result.stdout
|
||||
"distribute (0.7.3)" in result.stdout
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
|
||||
result = self.script.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % data.find_links, '-U', 'setuptools')
|
||||
assert "Found existing installation: setuptools 0.9.6" in result.stdout
|
||||
result = self.script.run(self.ve_bin/'pip', 'list')
|
||||
"setuptools (0.9.8)" in result.stdout
|
||||
|
|
|
@ -13,7 +13,7 @@ import pytest
|
|||
from pip.backwardcompat import uses_pycache
|
||||
|
||||
from tests.lib.local_repos import local_checkout
|
||||
from tests.lib import tests_data, pyversion, assert_all_changes, find_links
|
||||
from tests.lib import pyversion, assert_all_changes
|
||||
|
||||
|
||||
def _patch_dist_in_site_packages(script):
|
||||
|
@ -63,24 +63,24 @@ class Tests_UserSite:
|
|||
result.assert_installed('INITools', use_user_site=True)
|
||||
|
||||
|
||||
def test_install_curdir_usersite(self, script, virtualenv):
|
||||
def test_install_curdir_usersite(self, script, virtualenv, data):
|
||||
"""
|
||||
Test installing current directory ('.') into usersite
|
||||
"""
|
||||
virtualenv.system_site_packages = True
|
||||
run_from = abspath(join(tests_data, 'packages', 'FSPkg'))
|
||||
result = script.pip('install', '--user', curdir, cwd=run_from, expect_error=False)
|
||||
run_from = data.packages.join("FSPkg")
|
||||
result = script.pip('install', '-vvv', '--user', curdir, cwd=run_from, expect_error=False)
|
||||
fspkg_folder = script.user_site/'fspkg'
|
||||
egg_info_folder = script.user_site/'FSPkg-0.1dev-py%s.egg-info' % pyversion
|
||||
assert fspkg_folder in result.files_created, str(result.stdout)
|
||||
assert fspkg_folder in result.files_created, result.stdout
|
||||
|
||||
assert egg_info_folder in result.files_created, str(result)
|
||||
assert egg_info_folder in result.files_created
|
||||
|
||||
def test_install_user_venv_nositepkgs_fails(self, script):
|
||||
def test_install_user_venv_nositepkgs_fails(self, script, data):
|
||||
"""
|
||||
user install in virtualenv (with no system packages) fails with message
|
||||
"""
|
||||
run_from = abspath(join(tests_data, 'packages', 'FSPkg'))
|
||||
run_from = data.packages.join("FSPkg")
|
||||
result = script.pip('install', '--user', curdir, cwd=run_from, expect_error=True)
|
||||
assert "Can not perform a '--user' install. User site-packages are not visible in this virtualenv." in result.stdout
|
||||
|
||||
|
@ -210,7 +210,7 @@ class Tests_UserSite:
|
|||
result2 = script.pip('uninstall', '-y', 'INITools')
|
||||
assert_all_changes(result1, result2, [script.venv/'build', 'cache'])
|
||||
|
||||
def test_uninstall_editable_from_usersite(self, script, virtualenv):
|
||||
def test_uninstall_editable_from_usersite(self, script, virtualenv, data):
|
||||
"""
|
||||
Test uninstall editable local user install
|
||||
"""
|
||||
|
@ -218,7 +218,7 @@ class Tests_UserSite:
|
|||
script.user_site_path.makedirs()
|
||||
|
||||
#install
|
||||
to_install = abspath(join(tests_data, 'packages', 'FSPkg'))
|
||||
to_install = data.packages.join("FSPkg")
|
||||
result1 = script.pip('install', '--user', '-e', to_install, expect_error=False)
|
||||
egg_link = script.user_site/'FSPkg.egg-link'
|
||||
assert egg_link in result1.files_created, str(result1.stdout)
|
||||
|
@ -230,13 +230,13 @@ class Tests_UserSite:
|
|||
assert_all_changes(result1, result2,
|
||||
[script.venv/'build', 'cache', script.user_site/'easy-install.pth'])
|
||||
|
||||
def test_install_user_wheel(self, script, virtualenv):
|
||||
def test_install_user_wheel(self, script, virtualenv, data):
|
||||
"""
|
||||
Test user install from wheel
|
||||
"""
|
||||
virtualenv.system_site_packages = True
|
||||
script.pip_install_local('wheel')
|
||||
result = script.pip('install', 'simple.dist==0.1', '--user', '--use-wheel',
|
||||
'--no-index', '--find-links='+find_links)
|
||||
'--no-index', '--find-links='+data.find_links)
|
||||
egg_info_folder = script.user_site / 'simple.dist-0.1.dist-info'
|
||||
assert egg_info_folder in result.files_created, str(result)
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
from os.path import abspath, join
|
||||
|
||||
from tests.lib import tests_data, find_links
|
||||
from tests.lib.path import Path
|
||||
|
||||
|
||||
def test_install_from_wheel(script):
|
||||
def test_install_from_wheel(script, data):
|
||||
"""
|
||||
Test installing from a wheel.
|
||||
"""
|
||||
result = script.pip('install', 'simple.dist', '--use-wheel',
|
||||
'--no-index', '--find-links='+find_links,
|
||||
'--no-index', '--find-links='+data.find_links,
|
||||
expect_error=False)
|
||||
dist_info_folder = script.site_packages/'simple.dist-0.1.dist-info'
|
||||
assert dist_info_folder in result.files_created, (dist_info_folder,
|
||||
|
@ -17,12 +14,12 @@ def test_install_from_wheel(script):
|
|||
result.stdout)
|
||||
|
||||
|
||||
def test_install_from_wheel_with_extras(script):
|
||||
def test_install_from_wheel_with_extras(script, data):
|
||||
"""
|
||||
Test installing from a wheel with extras.
|
||||
"""
|
||||
result = script.pip('install', 'complex-dist[simple]', '--use-wheel',
|
||||
'--no-index', '--find-links='+find_links,
|
||||
'--no-index', '--find-links='+data.find_links,
|
||||
expect_error=False)
|
||||
dist_info_folder = script.site_packages/'complex_dist-0.1.dist-info'
|
||||
assert dist_info_folder in result.files_created, (dist_info_folder,
|
||||
|
@ -34,13 +31,11 @@ def test_install_from_wheel_with_extras(script):
|
|||
result.stdout)
|
||||
|
||||
|
||||
def test_install_from_wheel_file(script):
|
||||
def test_install_from_wheel_file(script, data):
|
||||
"""
|
||||
Test installing directly from a wheel file.
|
||||
"""
|
||||
package = abspath(join(tests_data,
|
||||
'packages',
|
||||
'headers.dist-0.1-py2.py3-none-any.whl'))
|
||||
package = data.packages.join("headers.dist-0.1-py2.py3-none-any.whl")
|
||||
result = script.pip('install', package, '--no-index', expect_error=False)
|
||||
dist_info_folder = script.site_packages/'headers.dist-0.1.dist-info'
|
||||
assert dist_info_folder in result.files_created, (dist_info_folder,
|
||||
|
@ -48,37 +43,33 @@ def test_install_from_wheel_file(script):
|
|||
result.stdout)
|
||||
|
||||
|
||||
def test_install_wheel_with_target(script):
|
||||
def test_install_wheel_with_target(script, data):
|
||||
"""
|
||||
Test installing a wheel using pip install --target
|
||||
"""
|
||||
script.pip_install_local('wheel')
|
||||
target_dir = script.scratch_path/'target'
|
||||
result = script.pip('install', 'simple.dist==0.1', '-t', target_dir, '--use-wheel',
|
||||
'--no-index', '--find-links='+find_links)
|
||||
'--no-index', '--find-links='+data.find_links)
|
||||
assert Path('scratch')/'target'/'simpledist' in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_from_wheel_installs_deps(script):
|
||||
def test_install_from_wheel_installs_deps(script, data):
|
||||
"""
|
||||
Test can install dependencies of wheels
|
||||
"""
|
||||
# 'requires_source' depends on the 'source' project
|
||||
package = abspath(join(tests_data,
|
||||
'packages',
|
||||
'requires_source-1.0-py2.py3-none-any.whl'))
|
||||
result = script.pip('install', '--no-index', '--find-links', find_links, package)
|
||||
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)
|
||||
result.assert_installed('source', editable=False)
|
||||
|
||||
|
||||
def test_install_from_wheel_no_deps(script):
|
||||
def test_install_from_wheel_no_deps(script, data):
|
||||
"""
|
||||
Test --no-deps works with wheel installs
|
||||
"""
|
||||
# 'requires_source' depends on the 'source' project
|
||||
package = abspath(join(tests_data,
|
||||
'packages',
|
||||
'requires_source-1.0-py2.py3-none-any.whl'))
|
||||
result = script.pip('install', '--no-index', '--find-links', find_links, '--no-deps', package)
|
||||
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)
|
||||
pkg_folder = script.site_packages/'source'
|
||||
assert pkg_folder not in result.files_created
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
import os
|
||||
import re
|
||||
import textwrap
|
||||
from tests.lib import find_links
|
||||
|
||||
from tests.lib.local_repos import local_checkout
|
||||
|
||||
|
||||
def test_list_command(script):
|
||||
def test_list_command(script, data):
|
||||
"""
|
||||
Test default behavior of list command.
|
||||
|
||||
"""
|
||||
script.pip('install', '-f', find_links, '--no-index', 'simple==1.0', 'simple2==3.0')
|
||||
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0', 'simple2==3.0')
|
||||
result = script.pip('list')
|
||||
assert 'simple (1.0)' in result.stdout, str(result)
|
||||
assert 'simple2 (3.0)' in result.stdout, str(result)
|
||||
|
||||
|
||||
def test_local_flag(script):
|
||||
def test_local_flag(script, data):
|
||||
"""
|
||||
Test the behavior of --local flag in the list command
|
||||
|
||||
"""
|
||||
script.pip('install', '-f', find_links, '--no-index', 'simple==1.0')
|
||||
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
|
||||
result = script.pip('list', '--local')
|
||||
assert 'simple (1.0)' in result.stdout
|
||||
|
||||
|
||||
def test_uptodate_flag(script):
|
||||
def test_uptodate_flag(script, data):
|
||||
"""
|
||||
Test the behavior of --uptodate flag in the list command
|
||||
|
||||
"""
|
||||
script.pip('install', '-f', find_links, '--no-index', 'simple==1.0', 'simple2==3.0')
|
||||
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0', 'simple2==3.0')
|
||||
script.pip('install', '-e', 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package')
|
||||
result = script.pip('list', '-f', find_links, '--no-index', '--uptodate')
|
||||
result = script.pip('list', '-f', data.find_links, '--no-index', '--uptodate')
|
||||
assert 'simple (1.0)' not in result.stdout #3.0 is latest
|
||||
assert 'pip-test-package' not in result.stdout #editables excluded
|
||||
assert 'simple2 (3.0)' in result.stdout, str(result)
|
||||
|
||||
|
||||
def test_outdated_flag(script):
|
||||
def test_outdated_flag(script, data):
|
||||
"""
|
||||
Test the behavior of --outdated flag in the list command
|
||||
|
||||
"""
|
||||
script.pip('install', '-f', find_links, '--no-index', 'simple==1.0', 'simple2==3.0')
|
||||
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0', 'simple2==3.0')
|
||||
script.pip('install', '-e', 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package')
|
||||
result = script.pip('list', '-f', find_links, '--no-index', '--outdated')
|
||||
result = script.pip('list', '-f', data.find_links, '--no-index', '--outdated')
|
||||
assert 'simple (Current: 1.0 Latest: 3.0)' in result.stdout
|
||||
assert 'pip-test-package' not in result.stdout #editables excluded
|
||||
assert 'simple2' not in result.stdout, str(result) #3.0 is latest
|
||||
|
||||
|
||||
def test_editables_flag(script):
|
||||
def test_editables_flag(script, data):
|
||||
"""
|
||||
Test the behavior of --editables flag in the list command
|
||||
"""
|
||||
script.pip('install', '-f', find_links, '--no-index', 'simple==1.0')
|
||||
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
|
||||
result = script.pip('install', '-e', 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package')
|
||||
result = script.pip('list', '--editable')
|
||||
assert 'simple (1.0)' not in result.stdout, str(result)
|
||||
|
|
|
@ -6,7 +6,7 @@ import sys
|
|||
from os.path import join, abspath, normpath
|
||||
from tempfile import mkdtemp
|
||||
from mock import patch
|
||||
from tests.lib import tests_data, assert_all_changes, pyversion
|
||||
from tests.lib import assert_all_changes, pyversion
|
||||
from tests.lib.local_repos import local_repo, local_checkout
|
||||
|
||||
from pip.util import rmtree
|
||||
|
@ -63,7 +63,7 @@ def test_uninstall_namespace_package(script):
|
|||
assert join(script.site_packages, 'pd', 'find') in result2.files_deleted, sorted(result2.files_deleted.keys())
|
||||
|
||||
|
||||
def test_uninstall_overlapping_package(script):
|
||||
def test_uninstall_overlapping_package(script, data):
|
||||
"""
|
||||
Uninstalling a distribution that adds modules to a pre-existing package
|
||||
should only remove those added modules, not the rest of the existing
|
||||
|
@ -71,8 +71,9 @@ def test_uninstall_overlapping_package(script):
|
|||
|
||||
See: GitHub issue #355 (pip uninstall removes things it didn't install)
|
||||
"""
|
||||
parent_pkg = abspath(join(tests_data, 'packages', 'parent-0.1.tar.gz'))
|
||||
child_pkg = abspath(join(tests_data, 'packages', 'child-0.1.tar.gz'))
|
||||
parent_pkg = data.packages.join("parent-0.1.tar.gz")
|
||||
child_pkg = data.packages.join("child-0.1.tar.gz")
|
||||
|
||||
result1 = script.pip('install', parent_pkg, expect_error=False)
|
||||
assert join(script.site_packages, 'parent') in result1.files_created, sorted(result1.files_created.keys())
|
||||
result2 = script.pip('install', child_pkg, expect_error=False)
|
||||
|
@ -175,12 +176,12 @@ def test_uninstall_from_reqs_file(script, tmpdir):
|
|||
script.site_packages/'easy-install.pth'])
|
||||
|
||||
|
||||
def test_uninstall_as_egg(script):
|
||||
def test_uninstall_as_egg(script, data):
|
||||
"""
|
||||
Test uninstall package installed as egg.
|
||||
|
||||
"""
|
||||
to_install = abspath(join(tests_data, 'packages', 'FSPkg'))
|
||||
to_install = data.packages.join("FSPkg")
|
||||
result = script.pip('install', to_install, '--egg', expect_error=False)
|
||||
fspkg_folder = script.site_packages/'fspkg'
|
||||
egg_folder = script.site_packages/'FSPkg-0.1dev-py%s.egg' % pyversion
|
||||
|
|
|
@ -9,35 +9,35 @@ from pip import wheel
|
|||
from pip.download import path_to_url as path_to_url_d
|
||||
from pip.locations import write_delete_marker_file
|
||||
from pip.status_codes import PREVIOUS_BUILD_DIR_ERROR
|
||||
from tests.lib import tests_data, pyversion_nodot, path_to_url, find_links
|
||||
from tests.lib import pyversion_nodot, path_to_url
|
||||
|
||||
|
||||
def test_pip_wheel_fails_without_wheel(script):
|
||||
def test_pip_wheel_fails_without_wheel(script, data):
|
||||
"""
|
||||
Test 'pip wheel' fails without wheel
|
||||
"""
|
||||
result = script.pip('wheel', '--no-index', '-f', find_links, 'simple==3.0', expect_error=True)
|
||||
result = script.pip('wheel', '--no-index', '-f', data.find_links, 'simple==3.0', expect_error=True)
|
||||
assert "'pip wheel' requires bdist_wheel" in result.stdout
|
||||
|
||||
|
||||
def test_pip_wheel_success(script):
|
||||
def test_pip_wheel_success(script, data):
|
||||
"""
|
||||
Test 'pip wheel' success.
|
||||
"""
|
||||
script.pip_install_local('wheel')
|
||||
result = script.pip('wheel', '--no-index', '-f', find_links, 'simple==3.0')
|
||||
result = script.pip('wheel', '--no-index', '-f', data.find_links, 'simple==3.0')
|
||||
wheel_file_name = 'simple-3.0-py%s-none-any.whl' % pyversion_nodot
|
||||
wheel_file_path = script.scratch/'wheelhouse'/wheel_file_name
|
||||
assert wheel_file_path in result.files_created, result.stdout
|
||||
assert "Successfully built simple" in result.stdout, result.stdout
|
||||
|
||||
|
||||
def test_pip_wheel_fail(script):
|
||||
def test_pip_wheel_fail(script, data):
|
||||
"""
|
||||
Test 'pip wheel' failure.
|
||||
"""
|
||||
script.pip_install_local('wheel')
|
||||
result = script.pip('wheel', '--no-index', '-f', find_links, 'wheelbroken==0.1')
|
||||
result = script.pip('wheel', '--no-index', '-f', data.find_links, 'wheelbroken==0.1')
|
||||
wheel_file_name = 'wheelbroken-0.1-py%s-none-any.whl' % pyversion_nodot
|
||||
wheel_file_path = script.scratch/'wheelhouse'/wheel_file_name
|
||||
assert wheel_file_path not in result.files_created, (wheel_file_path, result.files_created)
|
||||
|
@ -45,20 +45,20 @@ def test_pip_wheel_fail(script):
|
|||
assert "Failed to build wheelbroken" in result.stdout, result.stdout
|
||||
|
||||
|
||||
def test_pip_wheel_ignore_wheels_editables(script):
|
||||
def test_pip_wheel_ignore_wheels_editables(script, data):
|
||||
"""
|
||||
Test 'pip wheel' ignores editables and *.whl files in requirements
|
||||
"""
|
||||
script.pip_install_local('wheel')
|
||||
|
||||
local_wheel = '%s/simple.dist-0.1-py2.py3-none-any.whl' % find_links
|
||||
local_editable = os.path.abspath(os.path.join(tests_data, 'packages', 'FSPkg'))
|
||||
local_wheel = '%s/simple.dist-0.1-py2.py3-none-any.whl' % data.find_links
|
||||
local_editable = data.packages.join("FSPkg")
|
||||
script.scratch_path.join("reqs.txt").write(textwrap.dedent("""\
|
||||
%s
|
||||
-e %s
|
||||
simple
|
||||
""" % (local_wheel, local_editable)))
|
||||
result = script.pip('wheel', '--no-index', '-f', find_links, '-r', script.scratch_path / 'reqs.txt')
|
||||
result = script.pip('wheel', '--no-index', '-f', data.find_links, '-r', script.scratch_path / 'reqs.txt')
|
||||
wheel_file_name = 'simple-3.0-py%s-none-any.whl' % pyversion_nodot
|
||||
wheel_file_path = script.scratch/'wheelhouse'/wheel_file_name
|
||||
assert wheel_file_path in result.files_created, (wheel_file_path, result.files_created)
|
||||
|
@ -72,30 +72,30 @@ def test_pip_wheel_ignore_wheels_editables(script):
|
|||
assert ignore_editable in result.stdout, result.stdout
|
||||
|
||||
|
||||
def test_no_clean_option_blocks_cleaning_after_wheel(script):
|
||||
def test_no_clean_option_blocks_cleaning_after_wheel(script, data):
|
||||
"""
|
||||
Test --no-clean option blocks cleaning after wheel build
|
||||
"""
|
||||
script.pip_install_local('wheel')
|
||||
result = script.pip('wheel', '--no-clean', '--no-index', '--find-links=%s' % find_links, 'simple')
|
||||
result = script.pip('wheel', '--no-clean', '--no-index', '--find-links=%s' % data.find_links, 'simple')
|
||||
build = script.venv_path/'build'/'simple'
|
||||
assert exists(build), "build/simple should still exist %s" % str(result)
|
||||
|
||||
|
||||
def test_pip_wheel_source_deps(script):
|
||||
def test_pip_wheel_source_deps(script, data):
|
||||
"""
|
||||
Test 'pip wheel --use-wheel' finds and builds source archive dependencies of wheels
|
||||
"""
|
||||
# 'requires_source' is a wheel that depends on the 'source' project
|
||||
script.pip_install_local('wheel')
|
||||
result = script.pip('wheel', '--use-wheel', '--no-index', '-f', find_links, 'requires_source')
|
||||
result = script.pip('wheel', '--use-wheel', '--no-index', '-f', data.find_links, 'requires_source')
|
||||
wheel_file_name = 'source-1.0-py%s-none-any.whl' % pyversion_nodot
|
||||
wheel_file_path = script.scratch/'wheelhouse'/wheel_file_name
|
||||
assert wheel_file_path in result.files_created, result.stdout
|
||||
assert "Successfully built source" in result.stdout, result.stdout
|
||||
|
||||
|
||||
def test_pip_wheel_fail_cause_of_previous_build_dir(script):
|
||||
def test_pip_wheel_fail_cause_of_previous_build_dir(script, data):
|
||||
"""Test when 'pip wheel' tries to install a package that has a previous build directory"""
|
||||
|
||||
script.pip_install_local('wheel')
|
||||
|
@ -107,7 +107,7 @@ def test_pip_wheel_fail_cause_of_previous_build_dir(script):
|
|||
build.join('setup.py').write('#')
|
||||
|
||||
# When I call pip trying to install things again
|
||||
result = script.pip('wheel', '--no-index', '--find-links=%s' % find_links, 'simple==3.0', expect_error=True)
|
||||
result = script.pip('wheel', '--no-index', '--find-links=%s' % data.find_links, 'simple==3.0', expect_error=True)
|
||||
|
||||
# Then I see that the error code is the right one
|
||||
assert result.returncode == PREVIOUS_BUILD_DIR_ERROR
|
||||
|
|
|
@ -9,10 +9,9 @@ from pip.backwardcompat import urllib, BytesIO, b
|
|||
from pip.download import (_get_response_from_url as _get_response_from_url_original,
|
||||
path_to_url2, unpack_http_url, URLOpener)
|
||||
from pip.index import Link
|
||||
from tests.lib import tests_data
|
||||
|
||||
|
||||
def test_unpack_http_url_with_urllib_response_without_content_type():
|
||||
def test_unpack_http_url_with_urllib_response_without_content_type(data):
|
||||
"""
|
||||
It should download and unpack files even if no Content-Type header exists
|
||||
"""
|
||||
|
@ -22,7 +21,7 @@ def test_unpack_http_url_with_urllib_response_without_content_type():
|
|||
return resp
|
||||
|
||||
with patch('pip.download._get_response_from_url', _get_response_from_url_mock) as mocked:
|
||||
uri = path_to_url2(os.path.join(tests_data, 'packages', 'simple-1.0.tar.gz'))
|
||||
uri = path_to_url2(data.packages.join("simple-1.0.tar.gz"))
|
||||
link = Link(uri)
|
||||
temp_dir = mkdtemp()
|
||||
try:
|
||||
|
|
|
@ -5,11 +5,10 @@ import pytest
|
|||
from pip.download import _get_hash_from_file, _check_hash
|
||||
from pip.exceptions import InstallationError
|
||||
from pip.index import Link
|
||||
from tests.lib import packages
|
||||
|
||||
|
||||
def test_get_hash_from_file_md5():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_get_hash_from_file_md5(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#md5=d41d8cd98f00b204e9800998ecf8427e")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -18,8 +17,8 @@ def test_get_hash_from_file_md5():
|
|||
assert download_hash.hexdigest() == "d41d8cd98f00b204e9800998ecf8427e"
|
||||
|
||||
|
||||
def test_get_hash_from_file_sha1():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_get_hash_from_file_sha1(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha1=da39a3ee5e6b4b0d3255bfef95601890afd80709")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -28,8 +27,8 @@ def test_get_hash_from_file_sha1():
|
|||
assert download_hash.hexdigest() == "da39a3ee5e6b4b0d3255bfef95601890afd80709"
|
||||
|
||||
|
||||
def test_get_hash_from_file_sha224():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_get_hash_from_file_sha224(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha224=d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -38,8 +37,8 @@ def test_get_hash_from_file_sha224():
|
|||
assert download_hash.hexdigest() == "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f"
|
||||
|
||||
|
||||
def test_get_hash_from_file_sha384():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_get_hash_from_file_sha384(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha384=38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -48,8 +47,8 @@ def test_get_hash_from_file_sha384():
|
|||
assert download_hash.hexdigest() == "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b"
|
||||
|
||||
|
||||
def test_get_hash_from_file_sha256():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_get_hash_from_file_sha256(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -58,8 +57,8 @@ def test_get_hash_from_file_sha256():
|
|||
assert download_hash.hexdigest() == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
|
||||
def test_get_hash_from_file_sha512():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_get_hash_from_file_sha512(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha512=cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -68,8 +67,8 @@ def test_get_hash_from_file_sha512():
|
|||
assert download_hash.hexdigest() == "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"
|
||||
|
||||
|
||||
def test_get_hash_from_file_unknown():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_get_hash_from_file_unknown(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#unknown_hash=d41d8cd98f00b204e9800998ecf8427e")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -77,8 +76,8 @@ def test_get_hash_from_file_unknown():
|
|||
assert download_hash is None
|
||||
|
||||
|
||||
def test_check_hash_md5_valid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_md5_valid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#md5=d41d8cd98f00b204e9800998ecf8427e")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -86,8 +85,8 @@ def test_check_hash_md5_valid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_md5_invalid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_md5_invalid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#md5=deadbeef")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -96,8 +95,8 @@ def test_check_hash_md5_invalid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha1_valid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha1_valid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha1=da39a3ee5e6b4b0d3255bfef95601890afd80709")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -105,8 +104,8 @@ def test_check_hash_sha1_valid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha1_invalid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha1_invalid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha1=deadbeef")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -115,8 +114,8 @@ def test_check_hash_sha1_invalid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha224_valid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha224_valid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha224=d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f'")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -124,8 +123,8 @@ def test_check_hash_sha224_valid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha224_invalid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha224_invalid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha224=deadbeef")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -134,8 +133,8 @@ def test_check_hash_sha224_invalid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha384_valid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha384_valid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha384=38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -143,8 +142,8 @@ def test_check_hash_sha384_valid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha384_invalid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha384_invalid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha384=deadbeef")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -153,8 +152,8 @@ def test_check_hash_sha384_invalid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha256_valid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha256_valid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -162,8 +161,8 @@ def test_check_hash_sha256_valid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha256_invalid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha256_invalid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha256=deadbeef")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -172,8 +171,8 @@ def test_check_hash_sha256_invalid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha512_valid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha512_valid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha512=cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -181,8 +180,8 @@ def test_check_hash_sha512_valid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hash_sha512_invalid():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hash_sha512_invalid(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#sha512=deadbeef")
|
||||
|
||||
download_hash = _get_hash_from_file(file_path, file_link)
|
||||
|
@ -191,8 +190,8 @@ def test_check_hash_sha512_invalid():
|
|||
_check_hash(download_hash, file_link)
|
||||
|
||||
|
||||
def test_check_hasher_mismsatch():
|
||||
file_path = os.path.join(packages, "gmpy-1.15.tar.gz")
|
||||
def test_check_hasher_mismsatch(data):
|
||||
file_path = data.packages.join("gmpy-1.15.tar.gz")
|
||||
file_link = Link("http://testserver/gmpy-1.15.tar.gz#md5=d41d8cd98f00b204e9800998ecf8427e")
|
||||
other_link = Link("http://testserver/gmpy-1.15.tar.gz#sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import pytest
|
|||
from mock import patch
|
||||
|
||||
from pip.download import urlopen, VerifiedHTTPSHandler
|
||||
from tests.lib import assert_raises_regexp, tests_data
|
||||
from tests.lib import assert_raises_regexp
|
||||
from pip.backwardcompat import urllib2, URLError
|
||||
from pip.backwardcompat import CertificateError
|
||||
|
||||
|
@ -80,14 +80,12 @@ class TestsSSL:
|
|||
with pytest.raises(CertificateError):
|
||||
opener.open(pypi_https)
|
||||
|
||||
|
||||
def test_bad_pem_fails(self):
|
||||
def test_bad_pem_fails(self, data):
|
||||
"""
|
||||
Test ssl verification fails with bad pem file.
|
||||
Also confirms alternate --cert-path option works
|
||||
"""
|
||||
bad_cert = os.path.join(tests_data, 'packages', 'README.txt')
|
||||
bad_cert = data.packages.join("README.txt")
|
||||
os.environ['PIP_CERT'] = bad_cert
|
||||
o = urlopen.get_opener(scheme='https')
|
||||
assert_raises_regexp(URLError, '[sS][sS][lL]', o.open, pypi_https)
|
||||
|
||||
|
|
|
@ -2,53 +2,58 @@ import os
|
|||
|
||||
import pytest
|
||||
|
||||
import pip.wheel
|
||||
import pip.pep425tags
|
||||
|
||||
from pkg_resources import parse_version, Distribution
|
||||
from pip.backwardcompat import urllib
|
||||
from pip.req import InstallRequirement
|
||||
from pip.index import PackageFinder, Link
|
||||
from pip.exceptions import BestVersionAlreadyInstalled, DistributionNotFound
|
||||
from pip.util import Inf
|
||||
|
||||
from tests.lib.path import Path
|
||||
from tests.lib import tests_data, path_to_url, find_links, find_links2
|
||||
from tests.lib import path_to_url
|
||||
from mock import Mock, patch
|
||||
|
||||
|
||||
def test_no_mpkg():
|
||||
def test_no_mpkg(data):
|
||||
"""Finder skips zipfiles with "macosx10" in the name."""
|
||||
finder = PackageFinder([find_links], [])
|
||||
finder = PackageFinder([data.find_links], [])
|
||||
req = InstallRequirement.from_line("pkgwithmpkg")
|
||||
found = finder.find_requirement(req, False)
|
||||
|
||||
assert found.url.endswith("pkgwithmpkg-1.0.tar.gz"), found
|
||||
|
||||
|
||||
def test_no_partial_name_match():
|
||||
def test_no_partial_name_match(data):
|
||||
"""Finder requires the full project name to match, not just beginning."""
|
||||
finder = PackageFinder([find_links], [])
|
||||
finder = PackageFinder([data.find_links], [])
|
||||
req = InstallRequirement.from_line("gmpy")
|
||||
found = finder.find_requirement(req, False)
|
||||
|
||||
assert found.url.endswith("gmpy-1.15.tar.gz"), found
|
||||
|
||||
def test_duplicates_sort_ok():
|
||||
|
||||
def test_duplicates_sort_ok(data):
|
||||
"""Finder successfully finds one of a set of duplicates in different
|
||||
locations"""
|
||||
finder = PackageFinder([find_links, find_links2], [])
|
||||
finder = PackageFinder([data.find_links, data.find_links2], [])
|
||||
req = InstallRequirement.from_line("duplicate")
|
||||
found = finder.find_requirement(req, False)
|
||||
|
||||
assert found.url.endswith("duplicate-1.0.tar.gz"), found
|
||||
|
||||
|
||||
def test_finder_detects_latest_find_links():
|
||||
def test_finder_detects_latest_find_links(data):
|
||||
"""Test PackageFinder detects latest using find-links"""
|
||||
req = InstallRequirement.from_line('simple', None)
|
||||
finder = PackageFinder([find_links], [])
|
||||
finder = PackageFinder([data.find_links], [])
|
||||
link = finder.find_requirement(req, False)
|
||||
assert link.url.endswith("simple-3.0.tar.gz")
|
||||
|
||||
|
||||
def test_finder_detects_latest_already_satisfied_find_links():
|
||||
def test_finder_detects_latest_already_satisfied_find_links(data):
|
||||
"""Test PackageFinder detects latest already satisified using find-links"""
|
||||
req = InstallRequirement.from_line('simple', None)
|
||||
#the latest simple in local pkgs is 3.0
|
||||
|
@ -59,7 +64,7 @@ def test_finder_detects_latest_already_satisfied_find_links():
|
|||
version = latest_version
|
||||
)
|
||||
req.satisfied_by = satisfied_by
|
||||
finder = PackageFinder([find_links], [])
|
||||
finder = PackageFinder([data.find_links], [])
|
||||
|
||||
with pytest.raises(BestVersionAlreadyInstalled):
|
||||
finder.find_requirement(req, True)
|
||||
|
@ -82,45 +87,44 @@ def test_finder_detects_latest_already_satisfied_pypi_links():
|
|||
finder.find_requirement(req, True)
|
||||
|
||||
|
||||
# patch this for travis which has distribute in it's base env for now
|
||||
@patch('pip.wheel.pkg_resources.get_distribution', lambda x: Distribution(project_name='setuptools', version='0.9'))
|
||||
class TestWheel(object):
|
||||
class TestWheel:
|
||||
|
||||
@patch('pip.pep425tags.supported_tags', [('py1', 'none', 'any')])
|
||||
def test_not_find_wheel_not_supported(self):
|
||||
def test_not_find_wheel_not_supported(self, data, monkeypatch):
|
||||
"""
|
||||
Test not finding an unsupported wheel.
|
||||
"""
|
||||
monkeypatch.setattr(pip.wheel.pkg_resources, "get_distribution", lambda x: Distribution(project_name='setuptools', version='0.9'))
|
||||
monkeypatch.setattr(pip.pep425tags, "supported_tags", [('py1', 'none', 'any')])
|
||||
|
||||
req = InstallRequirement.from_line("simple.dist")
|
||||
finder = PackageFinder([find_links], [], use_wheel=True)
|
||||
finder = PackageFinder([data.find_links], [], use_wheel=True)
|
||||
|
||||
with pytest.raises(DistributionNotFound):
|
||||
finder.find_requirement(req, True)
|
||||
|
||||
|
||||
@patch('pip.pep425tags.supported_tags', [('py2', 'none', 'any')])
|
||||
def test_find_wheel_supported(self):
|
||||
def test_find_wheel_supported(self, data, monkeypatch):
|
||||
"""
|
||||
Test finding supported wheel.
|
||||
"""
|
||||
monkeypatch.setattr(pip.wheel.pkg_resources, "get_distribution", lambda x: Distribution(project_name='setuptools', version='0.9'))
|
||||
monkeypatch.setattr(pip.pep425tags, "supported_tags", [('py2', 'none', 'any')])
|
||||
|
||||
req = InstallRequirement.from_line("simple.dist")
|
||||
finder = PackageFinder([find_links], [], use_wheel=True)
|
||||
finder = PackageFinder([data.find_links], [], use_wheel=True)
|
||||
found = finder.find_requirement(req, True)
|
||||
assert found.url.endswith("simple.dist-0.1-py2.py3-none-any.whl"), found
|
||||
|
||||
|
||||
def test_wheel_over_sdist_priority(self):
|
||||
def test_wheel_over_sdist_priority(self, data):
|
||||
"""
|
||||
Test wheels have priority over sdists.
|
||||
`test_link_sorting` also covers this at lower level
|
||||
"""
|
||||
req = InstallRequirement.from_line("priority")
|
||||
finder = PackageFinder([find_links], [], use_wheel=True)
|
||||
finder = PackageFinder([data.find_links], [], use_wheel=True)
|
||||
found = finder.find_requirement(req, True)
|
||||
assert found.url.endswith("priority-1.0-py2.py3-none-any.whl"), found
|
||||
|
||||
|
||||
def test_existing_over_wheel_priority(self):
|
||||
def test_existing_over_wheel_priority(self, data):
|
||||
"""
|
||||
Test existing install has priority over wheels.
|
||||
`test_link_sorting` also covers this at a lower level
|
||||
|
@ -133,7 +137,7 @@ class TestWheel(object):
|
|||
version = latest_version
|
||||
)
|
||||
req.satisfied_by = satisfied_by
|
||||
finder = PackageFinder([find_links], [], use_wheel=True)
|
||||
finder = PackageFinder([data.find_links], [], use_wheel=True)
|
||||
|
||||
with pytest.raises(BestVersionAlreadyInstalled):
|
||||
finder.find_requirement(req, True)
|
||||
|
@ -165,10 +169,10 @@ class TestWheel(object):
|
|||
assert links == results == results2, results2
|
||||
|
||||
|
||||
def test_finder_priority_file_over_page():
|
||||
def test_finder_priority_file_over_page(data):
|
||||
"""Test PackageFinder prefers file links over equivalent page links"""
|
||||
req = InstallRequirement.from_line('gmpy==1.15', None)
|
||||
finder = PackageFinder([find_links], ["http://pypi.python.org/simple"])
|
||||
finder = PackageFinder([data.find_links], ["http://pypi.python.org/simple"])
|
||||
link = finder.find_requirement(req, False)
|
||||
assert link.url.startswith("file://")
|
||||
|
||||
|
@ -197,7 +201,7 @@ def test_finder_priority_nonegg_over_eggfragments():
|
|||
assert link.url.endswith('tar.gz')
|
||||
|
||||
|
||||
def test_finder_only_installs_stable_releases():
|
||||
def test_finder_only_installs_stable_releases(data):
|
||||
"""
|
||||
Test PackageFinder only accepts stable versioned releases by default.
|
||||
"""
|
||||
|
@ -205,8 +209,7 @@ def test_finder_only_installs_stable_releases():
|
|||
req = InstallRequirement.from_line("bar", None)
|
||||
|
||||
# using a local index (that has pre & dev releases)
|
||||
index_url = path_to_url(os.path.join(tests_data, 'indexes', 'pre'))
|
||||
finder = PackageFinder([], [index_url])
|
||||
finder = PackageFinder([], [data.index_url("pre")])
|
||||
link = finder.find_requirement(req, False)
|
||||
assert link.url.endswith("bar-1.0.tar.gz"), link.url
|
||||
|
||||
|
@ -221,7 +224,7 @@ def test_finder_only_installs_stable_releases():
|
|||
assert link.url == "https://foo/bar-1.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_installs_pre_releases():
|
||||
def test_finder_installs_pre_releases(data):
|
||||
"""
|
||||
Test PackageFinder finds pre-releases if asked to.
|
||||
"""
|
||||
|
@ -229,8 +232,7 @@ def test_finder_installs_pre_releases():
|
|||
req = InstallRequirement.from_line("bar", None, prereleases=True)
|
||||
|
||||
# using a local index (that has pre & dev releases)
|
||||
index_url = path_to_url(os.path.join(tests_data, 'indexes', 'pre'))
|
||||
finder = PackageFinder([], [index_url])
|
||||
finder = PackageFinder([], [data.index_url("pre")])
|
||||
link = finder.find_requirement(req, False)
|
||||
assert link.url.endswith("bar-2.0b1.tar.gz"), link.url
|
||||
|
||||
|
@ -245,7 +247,7 @@ def test_finder_installs_pre_releases():
|
|||
assert link.url == "https://foo/bar-2.0b1.tar.gz"
|
||||
|
||||
|
||||
def test_finder_installs_dev_releases():
|
||||
def test_finder_installs_dev_releases(data):
|
||||
"""
|
||||
Test PackageFinder finds dev releases if asked to.
|
||||
"""
|
||||
|
@ -253,8 +255,7 @@ def test_finder_installs_dev_releases():
|
|||
req = InstallRequirement.from_line("bar", None, prereleases=True)
|
||||
|
||||
# using a local index (that has dev releases)
|
||||
index_url = path_to_url(os.path.join(tests_data, 'indexes', 'dev'))
|
||||
finder = PackageFinder([], [index_url])
|
||||
finder = PackageFinder([], [data.index_url("dev")])
|
||||
link = finder.find_requirement(req, False)
|
||||
assert link.url.endswith("bar-2.0.dev1.tar.gz"), link.url
|
||||
|
||||
|
@ -276,20 +277,19 @@ def test_finder_installs_pre_releases_with_version_spec():
|
|||
assert link.url == "https://foo/bar-2.0b1.tar.gz"
|
||||
|
||||
|
||||
def test_finder_ignores_external_links():
|
||||
def test_finder_ignores_external_links(data):
|
||||
"""
|
||||
Tests that PackageFinder ignores external links, with or without hashes.
|
||||
"""
|
||||
req = InstallRequirement.from_line("bar", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url])
|
||||
finder = PackageFinder([], [data.index_url("externals")])
|
||||
link = finder.find_requirement(req, False)
|
||||
assert link.filename == "bar-1.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_with_hashes_per_project():
|
||||
def test_finder_finds_external_links_with_hashes_per_project(data):
|
||||
"""
|
||||
Tests that PackageFinder finds external links but only if they have a hash
|
||||
using the per project configuration.
|
||||
|
@ -297,13 +297,12 @@ def test_finder_finds_external_links_with_hashes_per_project():
|
|||
req = InstallRequirement.from_line("bar", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url], allow_external=["bar"])
|
||||
finder = PackageFinder([], [data.index_url("externals")], allow_external=["bar"])
|
||||
link = finder.find_requirement(req, False)
|
||||
assert link.filename == "bar-2.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_with_hashes_all():
|
||||
def test_finder_finds_external_links_with_hashes_all(data):
|
||||
"""
|
||||
Tests that PackageFinder finds external links but only if they have a hash
|
||||
using the all externals flag.
|
||||
|
@ -311,21 +310,19 @@ def test_finder_finds_external_links_with_hashes_all():
|
|||
req = InstallRequirement.from_line("bar", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url], allow_all_external=True)
|
||||
finder = PackageFinder([], [data.index_url("externals")], allow_all_external=True)
|
||||
link = finder.find_requirement(req, False)
|
||||
assert link.filename == "bar-2.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_without_hashes_per_project():
|
||||
def test_finder_finds_external_links_without_hashes_per_project(data):
|
||||
"""
|
||||
Tests that PackageFinder finds external links if they do not have a hash
|
||||
"""
|
||||
req = InstallRequirement.from_line("bar==3.0", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url],
|
||||
finder = PackageFinder([], [data.index_url("externals")],
|
||||
allow_external=["bar"],
|
||||
allow_insecure=["bar"],
|
||||
)
|
||||
|
@ -333,7 +330,7 @@ def test_finder_finds_external_links_without_hashes_per_project():
|
|||
assert link.filename == "bar-3.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_without_hashes_all():
|
||||
def test_finder_finds_external_links_without_hashes_all(data):
|
||||
"""
|
||||
Tests that PackageFinder finds external links if they do not have a hash
|
||||
using the all external flag
|
||||
|
@ -341,8 +338,7 @@ def test_finder_finds_external_links_without_hashes_all():
|
|||
req = InstallRequirement.from_line("bar==3.0", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url],
|
||||
finder = PackageFinder([], [data.index_url("externals")],
|
||||
allow_all_external=True,
|
||||
allow_insecure=["bar"],
|
||||
)
|
||||
|
@ -350,15 +346,14 @@ def test_finder_finds_external_links_without_hashes_all():
|
|||
assert link.filename == "bar-3.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_without_hashes_scraped_per_project():
|
||||
def test_finder_finds_external_links_without_hashes_scraped_per_project(data):
|
||||
"""
|
||||
Tests that PackageFinder finds externally scraped links
|
||||
"""
|
||||
req = InstallRequirement.from_line("bar", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url],
|
||||
finder = PackageFinder([], [data.index_url("externals")],
|
||||
allow_external=["bar"],
|
||||
allow_insecure=["bar"],
|
||||
)
|
||||
|
@ -366,7 +361,7 @@ def test_finder_finds_external_links_without_hashes_scraped_per_project():
|
|||
assert link.filename == "bar-4.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_without_hashes_scraped_all():
|
||||
def test_finder_finds_external_links_without_hashes_scraped_all(data):
|
||||
"""
|
||||
Tests that PackageFinder finds externally scraped links using the all
|
||||
external flag.
|
||||
|
@ -374,8 +369,7 @@ def test_finder_finds_external_links_without_hashes_scraped_all():
|
|||
req = InstallRequirement.from_line("bar", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url],
|
||||
finder = PackageFinder([], [data.index_url("externals")],
|
||||
allow_all_external=True,
|
||||
allow_insecure=["bar"],
|
||||
)
|
||||
|
@ -383,15 +377,14 @@ def test_finder_finds_external_links_without_hashes_scraped_all():
|
|||
assert link.filename == "bar-4.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_without_hashes_per_project_all_insecure():
|
||||
def test_finder_finds_external_links_without_hashes_per_project_all_insecure(data):
|
||||
"""
|
||||
Tests that PackageFinder finds external links if they do not have a hash
|
||||
"""
|
||||
req = InstallRequirement.from_line("bar==3.0", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url],
|
||||
finder = PackageFinder([], [data.index_url("externals")],
|
||||
allow_external=["bar"],
|
||||
allow_all_insecure=True,
|
||||
)
|
||||
|
@ -399,7 +392,7 @@ def test_finder_finds_external_links_without_hashes_per_project_all_insecure():
|
|||
assert link.filename == "bar-3.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_without_hashes_all_all_insecure():
|
||||
def test_finder_finds_external_links_without_hashes_all_all_insecure(data):
|
||||
"""
|
||||
Tests that PackageFinder finds external links if they do not have a hash
|
||||
using the all external flag
|
||||
|
@ -407,8 +400,7 @@ def test_finder_finds_external_links_without_hashes_all_all_insecure():
|
|||
req = InstallRequirement.from_line("bar==3.0", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url],
|
||||
finder = PackageFinder([], [data.index_url("externals")],
|
||||
allow_all_external=True,
|
||||
allow_all_insecure=True,
|
||||
)
|
||||
|
@ -416,15 +408,14 @@ def test_finder_finds_external_links_without_hashes_all_all_insecure():
|
|||
assert link.filename == "bar-3.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_without_hashes_scraped_per_project_all_insecure():
|
||||
def test_finder_finds_external_links_without_hashes_scraped_per_project_all_insecure(data):
|
||||
"""
|
||||
Tests that PackageFinder finds externally scraped links
|
||||
"""
|
||||
req = InstallRequirement.from_line("bar", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url],
|
||||
finder = PackageFinder([], [data.index_url("externals")],
|
||||
allow_external=["bar"],
|
||||
allow_all_insecure=True,
|
||||
)
|
||||
|
@ -432,7 +423,7 @@ def test_finder_finds_external_links_without_hashes_scraped_per_project_all_inse
|
|||
assert link.filename == "bar-4.0.tar.gz"
|
||||
|
||||
|
||||
def test_finder_finds_external_links_without_hashes_scraped_all_all_insecure():
|
||||
def test_finder_finds_external_links_without_hashes_scraped_all_all_insecure(data):
|
||||
"""
|
||||
Tests that PackageFinder finds externally scraped links using the all
|
||||
external flag.
|
||||
|
@ -440,8 +431,7 @@ def test_finder_finds_external_links_without_hashes_scraped_all_all_insecure():
|
|||
req = InstallRequirement.from_line("bar", None)
|
||||
|
||||
# using a local index
|
||||
index_url = path_to_url(os.path.join(tests_data, "indexes", "externals"))
|
||||
finder = PackageFinder([], [index_url],
|
||||
finder = PackageFinder([], [data.index_url("externals")],
|
||||
allow_all_external=True,
|
||||
allow_all_insecure=True,
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ from pip.backwardcompat import urllib
|
|||
from tests.lib.path import Path
|
||||
from pip.index import package_to_requirement, HTMLPage
|
||||
from pip.index import PackageFinder, Link, InfLink
|
||||
from tests.lib import tests_data, path_to_url, find_links
|
||||
from tests.lib import path_to_url
|
||||
from string import ascii_lowercase
|
||||
from mock import patch
|
||||
|
||||
|
@ -34,22 +34,21 @@ def test_html_page_should_be_able_to_scrap_rel_links():
|
|||
assert links[0].url == 'http://supervisord.org/'
|
||||
|
||||
|
||||
def test_sort_locations_file_find_link():
|
||||
def test_sort_locations_file_find_link(data):
|
||||
"""
|
||||
Test that a file:// find-link dir gets listdir run
|
||||
"""
|
||||
finder = PackageFinder([find_links], [])
|
||||
files, urls = finder._sort_locations([find_links])
|
||||
assert files and not urls, "files and not urls should have been found at find-links url: %s" % find_links
|
||||
finder = PackageFinder([data.find_links], [])
|
||||
files, urls = finder._sort_locations([data.find_links])
|
||||
assert files and not urls, "files and not urls should have been found at find-links url: %s" % data.find_links
|
||||
|
||||
|
||||
def test_sort_locations_file_not_find_link():
|
||||
def test_sort_locations_file_not_find_link(data):
|
||||
"""
|
||||
Test that a file:// url dir that's not a find-link, doesn't get a listdir run
|
||||
"""
|
||||
index_url = path_to_url(os.path.join(tests_data, 'indexes', 'empty_with_pkg'))
|
||||
finder = PackageFinder([], [])
|
||||
files, urls = finder._sort_locations([index_url])
|
||||
files, urls = finder._sort_locations(data.index_url("empty_with_pkg"))
|
||||
assert urls and not files, "urls, but not files should have been found"
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import tempfile
|
|||
|
||||
import pytest
|
||||
|
||||
import pip.wheel
|
||||
|
||||
from pkg_resources import Distribution
|
||||
from mock import Mock, patch
|
||||
from pip.exceptions import PreviousBuildDirError
|
||||
|
@ -11,7 +13,7 @@ from pip.index import PackageFinder
|
|||
from pip.log import logger
|
||||
from pip.req import (InstallRequirement, RequirementSet, parse_editable,
|
||||
Requirements, parse_requirements)
|
||||
from tests.lib import path_to_url, assert_raises_regexp, find_links, tests_data
|
||||
from tests.lib import assert_raises_regexp
|
||||
|
||||
|
||||
class TestRequirementSet(object):
|
||||
|
@ -126,14 +128,14 @@ def test_remote_reqs_parse():
|
|||
for req in parse_requirements('https://raw.github.com/pypa/pip-test-package/master/tests/req_just_comment.txt'):
|
||||
pass
|
||||
|
||||
# patch this for travis which has distribute in it's base env for now
|
||||
@patch('pip.wheel.pkg_resources.get_distribution', lambda x: Distribution(project_name='setuptools', version='0.9'))
|
||||
def test_req_file_parse_use_wheel():
|
||||
def test_req_file_parse_use_wheel(data, monkeypatch):
|
||||
"""
|
||||
Test parsing --use-wheel from a req file
|
||||
"""
|
||||
reqfile = os.path.join(tests_data, 'reqfiles', 'supported_options.txt')
|
||||
# patch this for travis which has distribute in it's base env for now
|
||||
monkeypatch.setattr(pip.wheel.pkg_resources, "get_distribution", lambda x: Distribution(project_name='setuptools', version='0.9'))
|
||||
|
||||
finder = PackageFinder([], [])
|
||||
for req in parse_requirements(reqfile, finder):
|
||||
for req in parse_requirements(data.reqfiles.join("supported_options.txt"), finder):
|
||||
pass
|
||||
assert finder.use_wheel
|
||||
|
|
|
@ -14,7 +14,6 @@ from mock import Mock, patch
|
|||
from pip.exceptions import BadCommand
|
||||
from pip.util import (egg_link_path, Inf, get_installed_distributions,
|
||||
find_command, untar_file, unzip_file)
|
||||
from tests.lib import tests_data
|
||||
|
||||
|
||||
class Tests_EgglinkPath:
|
||||
|
@ -334,18 +333,18 @@ class TestUnpackArchives(object):
|
|||
mode = self.mode(path)
|
||||
assert mode == expected_mode, "mode: %s, expected mode: %s" % (mode, expected_mode)
|
||||
|
||||
def test_unpack_tgz(self):
|
||||
def test_unpack_tgz(self, data):
|
||||
"""
|
||||
Test unpacking a *.tgz, and setting execute permissions
|
||||
"""
|
||||
test_file = os.path.join(tests_data, 'packages', 'test_tar.tgz')
|
||||
test_file = data.packages.join("test_tar.tgz")
|
||||
untar_file(test_file, self.tempdir)
|
||||
self.confirm_files()
|
||||
|
||||
def test_unpack_zip(self):
|
||||
def test_unpack_zip(self, data):
|
||||
"""
|
||||
Test unpacking a *.zip, and setting execute permissions
|
||||
"""
|
||||
test_file = os.path.join(tests_data, 'packages', 'test_zip.zip')
|
||||
test_file = data.packages.join("test_zip.zip")
|
||||
unzip_file(test_file, self.tempdir)
|
||||
self.confirm_files()
|
||||
|
|
|
@ -154,12 +154,15 @@ class TestWheelFile(object):
|
|||
rmtree(tmpdir)
|
||||
pass
|
||||
|
||||
def test_purelib_platlib(self):
|
||||
def test_purelib_platlib(self, data):
|
||||
"""
|
||||
Test the "wheel is purelib/platlib" code.
|
||||
"""
|
||||
packages = [("pure_wheel", os.path.join(os.path.dirname(__file__), os.pardir, "data/packages/pure_wheel-1.7"), True),
|
||||
("plat_wheel", os.path.join(os.path.dirname(__file__), os.pardir, "data/packages/plat_wheel-1.7"), False)]
|
||||
packages = [
|
||||
("pure_wheel", data.packages.join("pure_wheel-1.7"), True),
|
||||
("plat_wheel", data.packages.join("plat_wheel-1.7"), False),
|
||||
]
|
||||
|
||||
for name, path, expected in packages:
|
||||
assert wheel.root_is_purelib(name, path) == expected
|
||||
|
||||
|
|
Loading…
Reference in New Issue