6
6
import pytest
7
7
8
8
from tests .functional .test_install_user import _patch_dist_in_site_packages
9
- from tests .lib import pyversion # noqa: F401
10
9
from tests .lib import PipTestEnvironment , TestData , assert_all_changes
11
10
from tests .lib .venv import VirtualEnvironment
11
+ from tests .lib .wheel import make_wheel
12
12
13
13
14
14
@pytest .mark .incompatible_with_test_venv
@@ -28,14 +28,39 @@ def test_uninstall_from_usersite_with_dist_in_global_site(
28
28
"""
29
29
Test uninstall from usersite (with same dist in global site)
30
30
"""
31
+ entry_points_txt = "[console_scripts]\n script = pkg:func"
32
+ make_wheel (
33
+ "pkg" ,
34
+ "0.1" ,
35
+ extra_metadata_files = {"entry_points.txt" : entry_points_txt },
36
+ ).save_to_dir (script .scratch_path )
37
+ make_wheel (
38
+ "pkg" ,
39
+ "0.1.1" ,
40
+ extra_metadata_files = {"entry_points.txt" : entry_points_txt },
41
+ ).save_to_dir (script .scratch_path )
42
+
31
43
_patch_dist_in_site_packages (virtualenv )
32
44
33
- script .pip_install_local ("pip-test-package==0.1" , "--no-binary=:all:" )
45
+ script .pip (
46
+ "install" ,
47
+ "--no-index" ,
48
+ "--find-links" ,
49
+ script .scratch_path ,
50
+ "--no-warn-script-location" ,
51
+ "pkg==0.1" ,
52
+ )
34
53
35
- result2 = script .pip_install_local (
36
- "--user" , "pip-test-package==0.1.1" , "--no-binary=:all:"
54
+ result2 = script .pip (
55
+ "install" ,
56
+ "--no-index" ,
57
+ "--find-links" ,
58
+ script .scratch_path ,
59
+ "--no-warn-script-location" ,
60
+ "--user" ,
61
+ "pkg==0.1.1" ,
37
62
)
38
- result3 = script .pip ("uninstall" , "-vy" , "pip-test-package " )
63
+ result3 = script .pip ("uninstall" , "-vy" , "pkg " )
39
64
40
65
# uninstall console is mentioning user scripts, but not global scripts
41
66
assert normcase (script .user_bin_path ) in result3 .stdout , str (result3 )
@@ -45,13 +70,8 @@ def test_uninstall_from_usersite_with_dist_in_global_site(
45
70
assert_all_changes (result2 , result3 , [script .venv / "build" , "cache" ])
46
71
47
72
# site still has 0.2 (can't look in result1; have to check)
48
- # keep checking for egg-info because no-binary implies setup.py install
49
- egg_info_folder = (
50
- script .base_path
51
- / script .site_packages
52
- / f"pip_test_package-0.1-py{ pyversion } .egg-info"
53
- )
54
- assert isdir (egg_info_folder )
73
+ dist_info_folder = script .base_path / script .site_packages / "pkg-0.1.dist-info"
74
+ assert isdir (dist_info_folder )
55
75
56
76
def test_uninstall_editable_from_usersite (
57
77
self , script : PipTestEnvironment , data : TestData
0 commit comments