11
11
12
12
from pip ._internal .exceptions import InstallationError
13
13
from pip ._internal .locations import get_scheme
14
+ from pip ._internal .metadata import get_wheel_distribution
14
15
from pip ._internal .models .direct_url import (
15
16
DIRECT_URL_METADATA_NAME ,
16
17
ArchiveInfo ,
22
23
from pip ._internal .utils .compat import WINDOWS
23
24
from pip ._internal .utils .misc import hash_file
24
25
from pip ._internal .utils .unpacking import unpack_file
25
- from pip ._internal .utils .wheel import pkg_resources_distribution_for_wheel
26
26
from tests .lib import DATA_DIR , assert_paths_equal
27
27
from tests .lib .wheel import make_wheel
28
28
@@ -84,7 +84,7 @@ def test_get_legacy_build_wheel_path__multiple_names(caplog):
84
84
"進入點 = 套件.模組:函式" ,
85
85
],
86
86
)
87
- def test_get_entrypoints (console_scripts ):
87
+ def test_get_entrypoints (tmp_path , console_scripts ):
88
88
entry_points_text = """
89
89
[console_scripts]
90
90
{}
@@ -99,22 +99,18 @@ def test_get_entrypoints(console_scripts):
99
99
extra_metadata_files = {
100
100
"entry_points.txt" : entry_points_text ,
101
101
},
102
- ).as_zipfile ()
103
- distribution = pkg_resources_distribution_for_wheel (
104
- wheel_zip , "simple" , "<in memory>"
105
- )
102
+ ).save_to_dir (tmp_path )
103
+ distribution = get_wheel_distribution (wheel_zip , "simple" )
106
104
107
105
assert wheel .get_entrypoints (distribution ) == (
108
106
dict ([console_scripts .split (' = ' )]),
109
107
{},
110
108
)
111
109
112
110
113
- def test_get_entrypoints_no_entrypoints ():
114
- wheel_zip = make_wheel ("simple" , "0.1.0" ).as_zipfile ()
115
- distribution = pkg_resources_distribution_for_wheel (
116
- wheel_zip , "simple" , "<in memory>"
117
- )
111
+ def test_get_entrypoints_no_entrypoints (tmp_path ):
112
+ wheel_zip = make_wheel ("simple" , "0.1.0" ).save_to_dir (tmp_path )
113
+ distribution = get_wheel_distribution (wheel_zip , "simple" )
118
114
119
115
console , gui = wheel .get_entrypoints (distribution )
120
116
assert console == {}
0 commit comments