Skip to content

Commit 191df15

Browse files
committed
Use another shared script in pip list tests
1 parent 6cd9852 commit 191df15

File tree

1 file changed

+27
-34
lines changed

1 file changed

+27
-34
lines changed

tests/functional/test_list.py

+27-34
Original file line numberDiff line numberDiff line change
@@ -242,50 +242,53 @@ def test_outdated_columns_flag(script, data):
242242
assert 'simple2' not in result.stdout, str(result) # 3.0 is latest
243243

244244

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+
245259
@pytest.mark.network
246-
def test_editables_flag(script, data):
260+
def test_editables_flag(pip_test_package_script):
247261
"""
248262
Test the behavior of --editables flag in the list command
249263
"""
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')
257266
assert {"name": "simple", "version": "1.0"} \
258267
not in json.loads(result.stdout)
259268
assert os.path.join('src', 'pip-test-package') in result2.stdout
260269

261270

262271
@pytest.mark.network
263-
def test_exclude_editable_flag(script, data):
272+
def test_exclude_editable_flag(pip_test_package_script):
264273
"""
265274
Test the behavior of --editables flag in the list command
266275
"""
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'
271278
)
272-
result = script.pip('list', '--exclude-editable', '--format=json')
273279
assert {"name": "simple", "version": "1.0"} in json.loads(result.stdout)
274280
assert "pip-test-package" \
275281
not in {p["name"] for p in json.loads(result.stdout)}
276282

277283

278284
@pytest.mark.network
279-
def test_editables_columns_flag(script, data):
285+
def test_editables_columns_flag(pip_test_package_script):
280286
"""
281287
Test the behavior of --editables flag in the list command
282288
"""
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'
287291
)
288-
result = script.pip('list', '--editable', '--format=columns')
289292
assert 'Package' in result.stdout
290293
assert 'Version' in result.stdout
291294
assert 'Location' in result.stdout
@@ -295,16 +298,11 @@ def test_editables_columns_flag(script, data):
295298

296299

297300
@pytest.mark.network
298-
def test_uptodate_editables_flag(script, data):
301+
def test_uptodate_editables_flag(pip_test_package_script, data):
299302
"""
300303
test the behavior of --editable --uptodate flag in the list command
301304
"""
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(
308306
'list', '-f', data.find_links, '--no-index',
309307
'--editable', '--uptodate',
310308
)
@@ -315,17 +313,12 @@ def test_uptodate_editables_flag(script, data):
315313

316314

317315
@pytest.mark.network
318-
def test_uptodate_editables_columns_flag(script, data):
316+
def test_uptodate_editables_columns_flag(pip_test_package_script, data):
319317
"""
320318
test the behavior of --editable --uptodate --format=columns flag in the
321319
list command
322320
"""
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(
329322
'list', '-f', data.find_links, '--no-index',
330323
'--editable', '--uptodate', '--format=columns',
331324
)

0 commit comments

Comments
 (0)