mirror of https://github.com/pypa/pip
Merge pull request #7588 from uranusjr/reinstall-test
Delete a file to let --force-reinstall fix it
This commit is contained in:
commit
f2bb7c4e57
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
|
||||
from tests.lib import assert_all_changes
|
||||
|
||||
|
@ -22,10 +23,18 @@ def check_force_reinstall(script, specifier, expected):
|
|||
result = script.pip_install_local('simplewheel==1.0')
|
||||
check_installed_version(script, 'simplewheel', '1.0')
|
||||
|
||||
# Remove an installed file to test whether --force-reinstall fixes it.
|
||||
to_fix = script.site_packages_path.joinpath("simplewheel", "__init__.py")
|
||||
to_fix.unlink()
|
||||
|
||||
result2 = script.pip_install_local('--force-reinstall', specifier)
|
||||
assert result2.files_updated, 'force-reinstall failed'
|
||||
check_installed_version(script, 'simplewheel', expected)
|
||||
|
||||
# site_packages_path is absolute, but files_created mapping uses
|
||||
# relative paths as key.
|
||||
fixed_key = os.path.relpath(to_fix, script.base_path)
|
||||
assert fixed_key in result2.files_created, 'force-reinstall failed'
|
||||
|
||||
result3 = script.pip('uninstall', 'simplewheel', '-y')
|
||||
assert_all_changes(result, result3, [script.venv / 'build', 'cache'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue