Modify test to unify site_packages path usages
@@ -24,13 +24,17 @@ def check_force_reinstall(script, specifier, expected):
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")
+ to_fix = script.site_packages_path.joinpath("simplewheel", "__init__.py")
+ to_fix.unlink()
result2 = script.pip_install_local('--force-reinstall', specifier)
- assert to_fix in result2.files_created, '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'])
