@@ -242,50 +242,53 @@ def test_outdated_columns_flag(script, data):
242
242
assert 'simple2' not in result .stdout , str (result ) # 3.0 is latest
243
243
244
244
245
+ @pytest .fixture (scope = "session" )
246
+ def pip_test_package_script (tmpdir_factory , script_factory , shared_data ):
247
+ tmpdir = Path (str (tmpdir_factory .mktemp ("pip_test_package" )))
248
+ script = script_factory (tmpdir .joinpath ("workspace" ))
249
+ script .pip (
250
+ 'install' , '-f' , shared_data .find_links , '--no-index' , 'simple==1.0'
251
+ )
252
+ script .pip (
253
+ 'install' , '-e' ,
254
+ 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
255
+ )
256
+ return script
257
+
258
+
245
259
@pytest .mark .network
246
- def test_editables_flag (script , data ):
260
+ def test_editables_flag (pip_test_package_script ):
247
261
"""
248
262
Test the behavior of --editables flag in the list command
249
263
"""
250
- script .pip ('install' , '-f' , data .find_links , '--no-index' , 'simple==1.0' )
251
- result = script .pip (
252
- 'install' , '-e' ,
253
- 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
254
- )
255
- result = script .pip ('list' , '--editable' , '--format=json' )
256
- result2 = script .pip ('list' , '--editable' )
264
+ result = pip_test_package_script .pip ('list' , '--editable' , '--format=json' )
265
+ result2 = pip_test_package_script .pip ('list' , '--editable' )
257
266
assert {"name" : "simple" , "version" : "1.0" } \
258
267
not in json .loads (result .stdout )
259
268
assert os .path .join ('src' , 'pip-test-package' ) in result2 .stdout
260
269
261
270
262
271
@pytest .mark .network
263
- def test_exclude_editable_flag (script , data ):
272
+ def test_exclude_editable_flag (pip_test_package_script ):
264
273
"""
265
274
Test the behavior of --editables flag in the list command
266
275
"""
267
- script .pip ('install' , '-f' , data .find_links , '--no-index' , 'simple==1.0' )
268
- result = script .pip (
269
- 'install' , '-e' ,
270
- 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
276
+ result = pip_test_package_script .pip (
277
+ 'list' , '--exclude-editable' , '--format=json'
271
278
)
272
- result = script .pip ('list' , '--exclude-editable' , '--format=json' )
273
279
assert {"name" : "simple" , "version" : "1.0" } in json .loads (result .stdout )
274
280
assert "pip-test-package" \
275
281
not in {p ["name" ] for p in json .loads (result .stdout )}
276
282
277
283
278
284
@pytest .mark .network
279
- def test_editables_columns_flag (script , data ):
285
+ def test_editables_columns_flag (pip_test_package_script ):
280
286
"""
281
287
Test the behavior of --editables flag in the list command
282
288
"""
283
- script .pip ('install' , '-f' , data .find_links , '--no-index' , 'simple==1.0' )
284
- result = script .pip (
285
- 'install' , '-e' ,
286
- 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
289
+ result = pip_test_package_script .pip (
290
+ 'list' , '--editable' , '--format=columns'
287
291
)
288
- result = script .pip ('list' , '--editable' , '--format=columns' )
289
292
assert 'Package' in result .stdout
290
293
assert 'Version' in result .stdout
291
294
assert 'Location' in result .stdout
@@ -295,16 +298,11 @@ def test_editables_columns_flag(script, data):
295
298
296
299
297
300
@pytest .mark .network
298
- def test_uptodate_editables_flag (script , data ):
301
+ def test_uptodate_editables_flag (pip_test_package_script , data ):
299
302
"""
300
303
test the behavior of --editable --uptodate flag in the list command
301
304
"""
302
- script .pip ('install' , '-f' , data .find_links , '--no-index' , 'simple==1.0' )
303
- result = script .pip (
304
- 'install' , '-e' ,
305
- 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
306
- )
307
- result = script .pip (
305
+ result = pip_test_package_script .pip (
308
306
'list' , '-f' , data .find_links , '--no-index' ,
309
307
'--editable' , '--uptodate' ,
310
308
)
@@ -315,17 +313,12 @@ def test_uptodate_editables_flag(script, data):
315
313
316
314
317
315
@pytest .mark .network
318
- def test_uptodate_editables_columns_flag (script , data ):
316
+ def test_uptodate_editables_columns_flag (pip_test_package_script , data ):
319
317
"""
320
318
test the behavior of --editable --uptodate --format=columns flag in the
321
319
list command
322
320
"""
323
- script .pip ('install' , '-f' , data .find_links , '--no-index' , 'simple==1.0' )
324
- result = script .pip (
325
- 'install' , '-e' ,
326
- 'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
327
- )
328
- result = script .pip (
321
+ result = pip_test_package_script .pip (
329
322
'list' , '-f' , data .find_links , '--no-index' ,
330
323
'--editable' , '--uptodate' , '--format=columns' ,
331
324
)
0 commit comments