Delete a file to let --force-reinstall fix it

This commit is contained in:
Tzu-ping Chung 2020-01-13 17:57:39 +08:00
parent 7e65a5a40f
commit 2d3f2cdba5
2 changed files with 6 additions and 1 deletions

0
news/7587.trivial Normal file
View File

View File

@ -1,3 +1,4 @@
import os
from tests.lib import assert_all_changes
@ -22,8 +23,12 @@ 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.
script.site_packages_path.joinpath("simplewheel", "__init__.py").unlink()
to_fix = os.path.join(script.site_packages, "simplewheel", "__init__.py")
result2 = script.pip_install_local('--force-reinstall', specifier)
assert result2.files_updated, 'force-reinstall failed'
assert to_fix in result2.files_created, 'force-reinstall failed'
check_installed_version(script, 'simplewheel', expected)
result3 = script.pip('uninstall', 'simplewheel', '-y')