@@ -176,6 +176,16 @@ def egg_path(arch: str, pyver: str | None, tmp_path: Path) -> str:
176
176
return str (bdist_path )
177
177
178
178
179
+ @pytest .fixture
180
+ def expected_wheel_filename (pyver : str | None , arch : str ) -> str :
181
+ if arch != "any" :
182
+ pyver = pyver .replace ("." , "" ) if pyver else "py2.py3"
183
+ abiver = pyver .replace ("py" , "cp" )
184
+ return f"sampledist-1.0.0-{ pyver } -{ abiver } -{ arch } .whl"
185
+ else :
186
+ return "sampledist-1.0.0-py2.py3-none-any.whl"
187
+
188
+
179
189
def test_egg_re () -> None :
180
190
"""Make sure egg_info_re matches."""
181
191
egg_names_path = os .path .join (os .path .dirname (__file__ ), "eggnames.txt" )
@@ -191,10 +201,12 @@ def test_convert_egg_file(
191
201
tmp_path : Path ,
192
202
arch : str ,
193
203
expected_wheelfile : bytes ,
204
+ expected_wheel_filename : str ,
194
205
capsys : CaptureFixture ,
195
206
) -> None :
196
207
convert ([egg_path ], str (tmp_path ), verbose = True )
197
208
wheel_path = next (path for path in tmp_path .iterdir () if path .suffix == ".whl" )
209
+ assert wheel_path .name == expected_wheel_filename
198
210
with WheelFile (wheel_path ) as wf :
199
211
assert wf .read ("sampledist-1.0.0.dist-info/METADATA" ) == EXPECTED_METADATA
200
212
assert wf .read ("sampledist-1.0.0.dist-info/WHEEL" ) == expected_wheelfile
@@ -207,8 +219,10 @@ def test_convert_egg_directory(
207
219
egg_path : str ,
208
220
tmp_path : Path ,
209
221
tmp_path_factory : TempPathFactory ,
222
+ pyver : str | None ,
210
223
arch : str ,
211
224
expected_wheelfile : bytes ,
225
+ expected_wheel_filename : str ,
212
226
capsys : CaptureFixture ,
213
227
) -> None :
214
228
with zipfile .ZipFile (egg_path ) as egg_file :
@@ -218,6 +232,7 @@ def test_convert_egg_directory(
218
232
219
233
convert ([str (egg_dir_path )], str (tmp_path ), verbose = True )
220
234
wheel_path = next (path for path in tmp_path .iterdir () if path .suffix == ".whl" )
235
+ assert wheel_path .name == expected_wheel_filename
221
236
with WheelFile (wheel_path ) as wf :
222
237
assert wf .read ("sampledist-1.0.0.dist-info/METADATA" ) == EXPECTED_METADATA
223
238
assert wf .read ("sampledist-1.0.0.dist-info/WHEEL" ) == expected_wheelfile
@@ -231,10 +246,12 @@ def test_convert_bdist_wininst(
231
246
tmp_path : Path ,
232
247
arch : str ,
233
248
expected_wheelfile : bytes ,
249
+ expected_wheel_filename : str ,
234
250
capsys : CaptureFixture ,
235
251
) -> None :
236
252
convert ([bdist_wininst_path ], str (tmp_path ), verbose = True )
237
253
wheel_path = next (path for path in tmp_path .iterdir () if path .suffix == ".whl" )
254
+ assert wheel_path .name == expected_wheel_filename
238
255
with WheelFile (wheel_path ) as wf :
239
256
assert (
240
257
wf .read ("sampledist-1.0.0.data/scripts/somecommand" )
0 commit comments