mirror of https://github.com/pypa/pip
Add failing test for symlink uninstall
This commit is contained in:
parent
9b9d7b7d5d
commit
f8d58256b7
|
@ -458,6 +458,27 @@ def test_uninstall_wheel(script, data):
|
||||||
assert_all_changes(result, result2, [])
|
assert_all_changes(result, result2, [])
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif("sys.platform == 'win32'")
|
||||||
|
def test_uninstall_with_symlink(script, data, tmpdir):
|
||||||
|
"""
|
||||||
|
Test uninstalling a wheel, with an additional symlink
|
||||||
|
https://github.com/pypa/pip/issues/6892
|
||||||
|
"""
|
||||||
|
package = data.packages.joinpath("simple.dist-0.1-py2.py3-none-any.whl")
|
||||||
|
script.pip('install', package, '--no-index')
|
||||||
|
symlink_target = tmpdir / "target"
|
||||||
|
symlink_target.mkdir()
|
||||||
|
symlink_source = script.site_packages / "symlink"
|
||||||
|
(script.base_path / symlink_source).symlink_to(symlink_target)
|
||||||
|
st_mode = symlink_target.stat().st_mode
|
||||||
|
distinfo_path = script.site_packages_path / 'simple.dist-0.1.dist-info'
|
||||||
|
record_path = distinfo_path / 'RECORD'
|
||||||
|
record_path.append_text("symlink,,\n")
|
||||||
|
uninstall_result = script.pip('uninstall', 'simple.dist', '-y')
|
||||||
|
assert symlink_source in uninstall_result.files_deleted
|
||||||
|
assert symlink_target.stat().st_mode == st_mode
|
||||||
|
|
||||||
|
|
||||||
def test_uninstall_setuptools_develop_install(script, data):
|
def test_uninstall_setuptools_develop_install(script, data):
|
||||||
"""Try uninstall after setup.py develop followed of setup.py install"""
|
"""Try uninstall after setup.py develop followed of setup.py install"""
|
||||||
pkg_path = data.packages.joinpath("FSPkg")
|
pkg_path = data.packages.joinpath("FSPkg")
|
||||||
|
|
|
@ -203,9 +203,19 @@ class Path(_base):
|
||||||
with open(self, "w") as fp:
|
with open(self, "w") as fp:
|
||||||
fp.write(content)
|
fp.write(content)
|
||||||
|
|
||||||
|
def append_text(self, content):
|
||||||
|
with open(self, "a") as fp:
|
||||||
|
fp.write(content)
|
||||||
|
|
||||||
def touch(self):
|
def touch(self):
|
||||||
with open(self, "a") as fp:
|
with open(self, "a") as fp:
|
||||||
path = fp.fileno() if os.utime in supports_fd else self
|
path = fp.fileno() if os.utime in supports_fd else self
|
||||||
os.utime(path, None) # times is not optional on Python 2.7
|
os.utime(path, None) # times is not optional on Python 2.7
|
||||||
|
|
||||||
|
def symlink_to(self, target):
|
||||||
|
os.symlink(target, self)
|
||||||
|
|
||||||
|
def stat(self):
|
||||||
|
return os.stat(self)
|
||||||
|
|
||||||
curdir = Path(os.path.curdir)
|
curdir = Path(os.path.curdir)
|
||||||
|
|
Loading…
Reference in New Issue