7
7
8
8
import pytest
9
9
from _pytest .fixtures import SubRequest
10
- from pytest import TempPathFactory
10
+ from pytest import CaptureFixture , TempPathFactory
11
11
12
12
import wheel
13
13
from wheel .cli .convert import convert , egg_filename_re
14
- from wheel .wheelfile import WHEEL_INFO_RE , WheelFile
14
+ from wheel .wheelfile import WheelFile
15
15
16
16
PKG_INFO = """\
17
17
Metadata-Version: 2.1
@@ -187,47 +187,54 @@ def test_egg_re() -> None:
187
187
188
188
189
189
def test_convert_egg_file (
190
- egg_path : str , tmp_path : Path , arch : str , expected_wheelfile : bytes
190
+ egg_path : str ,
191
+ tmp_path : Path ,
192
+ arch : str ,
193
+ expected_wheelfile : bytes ,
194
+ capsys : CaptureFixture ,
191
195
) -> None :
192
- convert ([egg_path ], str (tmp_path ), verbose = False )
196
+ convert ([egg_path ], str (tmp_path ), verbose = True )
193
197
wheel_path = next (path for path in tmp_path .iterdir () if path .suffix == ".whl" )
194
- assert WHEEL_INFO_RE .match (wheel_path .name )
195
198
with WheelFile (wheel_path ) as wf :
196
199
assert wf .read ("sampledist-1.0.0.dist-info/METADATA" ) == EXPECTED_METADATA
197
200
assert wf .read ("sampledist-1.0.0.dist-info/WHEEL" ) == expected_wheelfile
198
201
assert wf .read ("sampledist-1.0.0.dist-info/entry_points.txt" ) == b""
199
202
203
+ assert capsys .readouterr ().out == f"{ egg_path } ...OK\n "
204
+
200
205
201
206
def test_convert_egg_directory (
202
207
egg_path : str ,
203
208
tmp_path : Path ,
204
209
tmp_path_factory : TempPathFactory ,
205
210
arch : str ,
206
211
expected_wheelfile : bytes ,
212
+ capsys : CaptureFixture ,
207
213
) -> None :
208
214
with zipfile .ZipFile (egg_path ) as egg_file :
209
215
egg_dir_path = tmp_path_factory .mktemp ("eggdir" ) / Path (egg_path ).name
210
216
egg_dir_path .mkdir ()
211
217
egg_file .extractall (egg_dir_path )
212
218
213
- convert ([str (egg_dir_path )], str (tmp_path ), verbose = False )
219
+ convert ([str (egg_dir_path )], str (tmp_path ), verbose = True )
214
220
wheel_path = next (path for path in tmp_path .iterdir () if path .suffix == ".whl" )
215
- assert WHEEL_INFO_RE .match (wheel_path .name )
216
221
with WheelFile (wheel_path ) as wf :
217
222
assert wf .read ("sampledist-1.0.0.dist-info/METADATA" ) == EXPECTED_METADATA
218
223
assert wf .read ("sampledist-1.0.0.dist-info/WHEEL" ) == expected_wheelfile
219
224
assert wf .read ("sampledist-1.0.0.dist-info/entry_points.txt" ) == b""
220
225
226
+ assert capsys .readouterr ().out == f"{ egg_dir_path } ...OK\n "
227
+
221
228
222
229
def test_convert_bdist_wininst (
223
230
bdist_wininst_path : str ,
224
231
tmp_path : Path ,
225
232
arch : str ,
226
233
expected_wheelfile : bytes ,
234
+ capsys : CaptureFixture ,
227
235
) -> None :
228
- convert ([bdist_wininst_path ], str (tmp_path ), verbose = False )
236
+ convert ([bdist_wininst_path ], str (tmp_path ), verbose = True )
229
237
wheel_path = next (path for path in tmp_path .iterdir () if path .suffix == ".whl" )
230
- assert WHEEL_INFO_RE .match (wheel_path .name )
231
238
with WheelFile (wheel_path ) as wf :
232
239
assert (
233
240
wf .read ("sampledist-1.0.0.data/scripts/somecommand" )
@@ -236,3 +243,5 @@ def test_convert_bdist_wininst(
236
243
assert wf .read ("sampledist-1.0.0.dist-info/METADATA" ) == EXPECTED_METADATA
237
244
assert wf .read ("sampledist-1.0.0.dist-info/WHEEL" ) == expected_wheelfile
238
245
assert wf .read ("sampledist-1.0.0.dist-info/entry_points.txt" ) == b""
246
+
247
+ assert capsys .readouterr ().out == f"{ bdist_wininst_path } ...OK\n "
0 commit comments