1
- import json
2
1
import os
3
2
import re
4
3
@@ -22,18 +21,6 @@ def test_basic_show(script):
22
21
assert 'Requires: ' in lines
23
22
24
23
25
- def test_basic_show_json (script ):
26
- """
27
- Test end to end test for show command.
28
- """
29
- result = script .pip ('show' , 'pip' , '--format=json' )
30
- data = json .loads (result .stdout )[0 ]
31
- assert len (data ) == 10
32
- assert data ['name' ] == 'pip'
33
- assert data ['version' ] == '{}' .format (__version__ )
34
- assert {'location' , 'requires' } <= set (data )
35
-
36
-
37
24
def test_show_with_files_not_found (script , data ):
38
25
"""
39
26
Test for show command with installed files listing enabled and
@@ -52,21 +39,6 @@ def test_show_with_files_not_found(script, data):
52
39
assert 'Cannot locate installed-files.txt' in lines
53
40
54
41
55
- def test_show_with_files_not_found_json (script , data ):
56
- """
57
- Test for show command with installed files listing enabled and
58
- installed-files.txt not found.
59
- """
60
- editable = data .packages .joinpath ('SetupPyUTF8' )
61
- script .pip ('install' , '-e' , editable )
62
- result = script .pip ('show' , '-f' , 'SetupPyUTF8' , '--format=json' )
63
- data = json .loads (result .stdout )[0 ]
64
- assert data ['name' ] == 'SetupPyUTF8'
65
- assert data ['version' ] == '0.0.0'
66
- assert {'location' , 'requires' } <= set (data )
67
- assert not data ['files' ]
68
-
69
-
70
42
def test_show_with_files_from_wheel (script , data ):
71
43
"""
72
44
Test that a wheel's files can be listed
@@ -80,18 +52,6 @@ def test_show_with_files_from_wheel(script, data):
80
52
assert re .search (r"Files:\n( .+\n)+" , result .stdout )
81
53
82
54
83
- def test_show_with_files_from_wheel_json (script , data ):
84
- """
85
- Test that a wheel's files can be listed
86
- """
87
- wheel_file = data .packages .joinpath ('simple.dist-0.1-py2.py3-none-any.whl' )
88
- script .pip ('install' , '--no-index' , wheel_file )
89
- result = script .pip ('show' , '-f' , 'simple.dist' , '--format=json' )
90
- data = json .loads (result .stdout )[0 ]
91
- assert data ['name' ] == 'simple.dist'
92
- assert data ['files' ]
93
-
94
-
95
55
@pytest .mark .network
96
56
def test_show_with_all_files (script ):
97
57
"""
@@ -104,17 +64,6 @@ def test_show_with_all_files(script):
104
64
assert re .search (r"Files:\n( .+\n)+" , result .stdout )
105
65
106
66
107
- @pytest .mark .network
108
- def test_show_with_all_files_json (script ):
109
- """
110
- Test listing all files in the show command.
111
- """
112
- script .pip ('install' , 'initools==0.2' )
113
- result = script .pip ('show' , '--files' , 'initools' , '--format=json' )
114
- data = json .loads (result .stdout )[0 ]
115
- assert data ['files' ]
116
-
117
-
118
67
def test_missing_argument (script ):
119
68
"""
120
69
Test show command with no arguments.
@@ -159,21 +108,6 @@ def test_report_mixed_not_found(script):
159
108
assert 'Name: pip' in lines
160
109
161
110
162
- def test_report_mixed_not_found_json (script ):
163
- """
164
- Test passing a mixture of found and not-found names.
165
- """
166
- # We test passing non-canonicalized names.
167
- result = script .pip (
168
- 'show' , 'Abcd3' , 'A-B-C' , 'pip' , '--format=json' ,
169
- allow_stderr_warning = True
170
- )
171
- assert 'WARNING: Package(s) not found: A-B-C, Abcd3' in result .stderr
172
- print (result .stdout )
173
- data = json .loads (result .stdout )[0 ]
174
- assert data ['name' ] == 'pip'
175
-
176
-
177
111
def test_search_any_case ():
178
112
"""
179
113
Search for a package in any case.
@@ -204,17 +138,6 @@ def test_show_verbose_with_classifiers(script):
204
138
assert "Intended Audience :: Developers" in result .stdout
205
139
206
140
207
- def test_show_verbose_with_classifiers_json (script ):
208
- """
209
- Test that classifiers can be listed
210
- """
211
- result = script .pip ('show' , 'pip' , '--verbose' , '--format=json' )
212
- data = json .loads (result .stdout )[0 ]
213
- assert data ['name' ] == 'pip'
214
- assert data ['classifiers' ]
215
- assert "Intended Audience :: Developers" in data ["classifiers" ]
216
-
217
-
218
141
def test_show_verbose_installer (script , data ):
219
142
"""
220
143
Test that the installer is shown (this currently needs a wheel install)
@@ -227,18 +150,6 @@ def test_show_verbose_installer(script, data):
227
150
assert 'Installer: pip' in lines
228
151
229
152
230
- def test_show_verbose_installer_json (script , data ):
231
- """
232
- Test that the installer is shown (this currently needs a wheel install)
233
- """
234
- wheel_file = data .packages .joinpath ('simple.dist-0.1-py2.py3-none-any.whl' )
235
- script .pip ('install' , '--no-index' , wheel_file )
236
- result = script .pip ('show' , '--verbose' , 'simple.dist' , '--format=json' )
237
- data = json .loads (result .stdout )[0 ]
238
- assert data ['name' ] == 'simple.dist'
239
- assert data ['installer' ] == 'pip'
240
-
241
-
242
153
def test_show_verbose (script ):
243
154
"""
244
155
Test end to end test for verbose show command.
@@ -251,17 +162,6 @@ def test_show_verbose(script):
251
162
assert 'Classifiers:' in lines
252
163
253
164
254
- def test_show_verbose_json (script ):
255
- """
256
- Test end to end test for verbose show command.
257
- """
258
- result = script .pip ('show' , '--verbose' , 'pip' , '--format=json' )
259
- data = json .loads (result .stdout )[0 ]
260
-
261
- assert {'metadata-version' , 'installer' ,
262
- 'entry-points' , 'classifiers' } <= set (data )
263
-
264
-
265
165
def test_all_fields (script ):
266
166
"""
267
167
Test that all the fields are present
@@ -275,18 +175,6 @@ def test_all_fields(script):
275
175
assert actual == expected
276
176
277
177
278
- def test_all_fields_json (script ):
279
- """
280
- Test that all the fields are present
281
- """
282
- result = script .pip ('show' , 'pip' , '--format=json' )
283
- data = json .loads (result .stdout )[0 ]
284
- expected = {'name' , 'version' , 'summary' , 'home-page' , 'author' ,
285
- 'author-email' , 'license' , 'location' , 'requires' ,
286
- 'required-by' }
287
- assert set (data ) == expected
288
-
289
-
290
178
def test_pip_show_is_short (script ):
291
179
"""
292
180
Test that pip show stays short
@@ -296,15 +184,6 @@ def test_pip_show_is_short(script):
296
184
assert len (lines ) <= 10
297
185
298
186
299
- def test_pip_show_is_short_json (script ):
300
- """
301
- Test that pip show stays short
302
- """
303
- result = script .pip ('show' , 'pip' , '--format=json' )
304
- data = json .loads (result .stdout )[0 ]
305
- assert len (data ) <= 10
306
-
307
-
308
187
def test_pip_show_divider (script , data ):
309
188
"""
310
189
Expect a divider between packages
@@ -343,22 +222,6 @@ def test_show_required_by_packages_basic(script, data):
343
222
assert 'Required-by: requires-simple' in lines
344
223
345
224
346
- def test_show_required_by_packages_basic_json (script , data ):
347
- """
348
- Test that installed packages that depend on this package are shown
349
- """
350
- editable_path = os .path .join (data .src , 'requires_simple' )
351
- script .pip (
352
- 'install' , '--no-index' , '-f' , data .find_links , editable_path
353
- )
354
-
355
- result = script .pip ('show' , 'simple' , '--format=json' )
356
- data = json .loads (result .stdout )[0 ]
357
-
358
- assert data ['name' ] == 'simple'
359
- assert data ['required-by' ] == ['requires-simple' ]
360
-
361
-
362
225
def test_show_required_by_packages_capitalized (script , data ):
363
226
"""
364
227
Test that the installed packages which depend on a package are shown
@@ -376,23 +239,6 @@ def test_show_required_by_packages_capitalized(script, data):
376
239
assert 'Required-by: Requires-Capitalized' in lines
377
240
378
241
379
- def test_show_required_by_packages_capitalized_json (script , data ):
380
- """
381
- Test that the installed packages which depend on a package are shown
382
- where the package has a capital letter
383
- """
384
- editable_path = os .path .join (data .src , 'requires_capitalized' )
385
- script .pip (
386
- 'install' , '--no-index' , '-f' , data .find_links , editable_path
387
- )
388
-
389
- result = script .pip ('show' , 'simple' , '--format=json' )
390
- data = json .loads (result .stdout )[0 ]
391
-
392
- assert data ['name' ] == 'simple'
393
- assert data ['required-by' ] == ['Requires-Capitalized' ]
394
-
395
-
396
242
def test_show_required_by_packages_requiring_capitalized (script , data ):
397
243
"""
398
244
Test that the installed packages which depend on a package are shown
@@ -415,28 +261,6 @@ def test_show_required_by_packages_requiring_capitalized(script, data):
415
261
assert 'Required-by: requires-requires-capitalized' in lines
416
262
417
263
418
- def test_show_required_by_packages_requiring_capitalized_json (script , data ):
419
- """
420
- Test that the installed packages which depend on a package are shown
421
- where the package has a name with a mix of
422
- lower and upper case letters
423
- """
424
- required_package_path = os .path .join (data .src , 'requires_capitalized' )
425
- script .pip (
426
- 'install' , '--no-index' , '-f' , data .find_links , required_package_path
427
- )
428
- editable_path = os .path .join (data .src , 'requires_requires_capitalized' )
429
- script .pip (
430
- 'install' , '--no-index' , '-f' , data .find_links , editable_path
431
- )
432
-
433
- result = script .pip ('show' , 'Requires_Capitalized' , '--format=json' )
434
- data = json .loads (result .stdout )[0 ]
435
-
436
- assert data ['name' ] == 'Requires-Capitalized'
437
- assert data ['required-by' ] == ['requires-requires-capitalized' ]
438
-
439
-
440
264
def test_show_skip_work_dir_pkg (script ):
441
265
"""
442
266
Test that show should not include package
0 commit comments