1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
pip/tests/functional/test_list.py

102 lines
3 KiB
Python
Raw Normal View History

2013-01-23 05:52:35 +01:00
import os
2015-01-15 00:53:15 +01:00
import pytest
2011-03-19 19:30:56 +01:00
def test_list_command(script, data):
2012-09-13 00:50:25 +02:00
"""
Test default behavior of list command.
"""
script.pip(
'install', '-f', data.find_links, '--no-index', 'simple==1.0',
'simple2==3.0',
)
result = script.pip('list')
assert 'simple (1.0)' in result.stdout, str(result)
assert 'simple2 (3.0)' in result.stdout, str(result)
2012-09-13 00:50:25 +02:00
def test_local_flag(script, data):
2011-03-19 19:30:56 +01:00
"""
Test the behavior of --local flag in the list command
2012-09-13 00:50:25 +02:00
2011-03-19 19:30:56 +01:00
"""
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
result = script.pip('list', '--local')
assert 'simple (1.0)' in result.stdout
2011-03-19 19:30:56 +01:00
2014-10-14 21:07:50 +02:00
def test_user_flag(script, data, virtualenv):
"""
Test the behavior of --user flag in the list command
"""
virtualenv.system_site_packages = True
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
script.pip('install', '-f', data.find_links, '--no-index',
'--user', 'simple2==2.0')
result = script.pip('list', '--user')
assert 'simple (1.0)' not in result.stdout
assert 'simple2 (2.0)' in result.stdout
2015-01-15 00:53:15 +01:00
@pytest.mark.network
def test_uptodate_flag(script, data):
"""
Test the behavior of --uptodate flag in the list command
"""
script.pip(
'install', '-f', data.find_links, '--no-index', 'simple==1.0',
'simple2==3.0',
)
script.pip(
'install', '-e',
'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
)
result = script.pip(
'list', '-f', data.find_links, '--no-index', '--uptodate'
)
assert 'simple (1.0)' not in result.stdout # 3.0 is latest
assert 'pip-test-package' not in result.stdout # editables excluded
assert 'simple2 (3.0)' in result.stdout, str(result)
2015-01-15 00:53:15 +01:00
@pytest.mark.network
def test_outdated_flag(script, data):
"""
Test the behavior of --outdated flag in the list command
"""
script.pip(
'install', '-f', data.find_links, '--no-index', 'simple==1.0',
'simple2==3.0',
)
script.pip(
'install', '-e',
'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
)
result = script.pip(
'list', '-f', data.find_links, '--no-index', '--outdated',
)
assert 'simple (Current: 1.0 Latest: 3.0)' in result.stdout
assert 'pip-test-package' not in result.stdout # editables excluded
assert 'simple2' not in result.stdout, str(result) # 3.0 is latest
2012-12-18 06:34:37 +01:00
2015-01-15 00:53:15 +01:00
@pytest.mark.network
def test_editables_flag(script, data):
2012-12-18 06:34:37 +01:00
"""
Test the behavior of --editables flag in the list command
"""
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
result = script.pip(
'install', '-e',
'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
)
result = script.pip('list', '--editable')
assert 'simple (1.0)' not in result.stdout, str(result)
assert os.path.join('src', 'pip-test-package') in result.stdout, (
str(result)
)