mirror of https://github.com/pypa/pip
Ensure that --root continues to work with Wheels
This commit is contained in:
parent
97507f8931
commit
00c11deb25
|
@ -153,4 +153,10 @@ def distutils_scheme(dist_name, user=False, home=None, root=None):
|
|||
'python' + sys.version[:3],
|
||||
dist_name)
|
||||
|
||||
if root is not None:
|
||||
scheme["headers"] = os.path.join(
|
||||
root,
|
||||
os.path.abspath(scheme["headers"])[1:],
|
||||
)
|
||||
|
||||
return scheme
|
||||
|
|
|
@ -57,6 +57,16 @@ def test_install_wheel_with_target(script, data):
|
|||
assert Path('scratch')/'target'/'simpledist' in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_wheel_with_root(script, data):
|
||||
"""
|
||||
Test installing a wheel using pip install --root
|
||||
"""
|
||||
root_dir = script.scratch_path/'root'
|
||||
result = script.pip('install', 'simple.dist==0.1', '--root', root_dir, '--use-wheel',
|
||||
'--no-index', '--find-links='+data.find_links)
|
||||
assert Path('scratch')/'root' in result.files_created
|
||||
|
||||
|
||||
def test_install_from_wheel_installs_deps(script, data):
|
||||
"""
|
||||
Test can install dependencies of wheels
|
||||
|
|
|
@ -13,6 +13,8 @@ import pytest
|
|||
from mock import Mock
|
||||
import pip
|
||||
|
||||
from pip.locations import distutils_scheme
|
||||
|
||||
if sys.platform == 'win32':
|
||||
pwd = Mock()
|
||||
else:
|
||||
|
@ -120,3 +122,14 @@ class TestLocations:
|
|||
from pip import locations
|
||||
os.mkdir(self.get_build_dir_location())
|
||||
locations._get_build_prefix()
|
||||
|
||||
|
||||
class TestDisutilsScheme:
|
||||
|
||||
def test_root_modifies_appropiately(self):
|
||||
norm_scheme = distutils_scheme("example")
|
||||
root_scheme = distutils_scheme("example", root="/test/root/")
|
||||
|
||||
for key, value in norm_scheme.items():
|
||||
expected = os.path.join("/test/root/", os.path.abspath(value)[1:])
|
||||
assert root_scheme[key] == expected
|
||||
|
|
Loading…
Reference in New Issue