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
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_list_command(script, data):
|
2012-09-13 00:50:25 +02:00
|
|
|
"""
|
|
|
|
Test default behavior of list command.
|
|
|
|
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
script.pip(
|
|
|
|
'install', '-f', data.find_links, '--no-index', 'simple==1.0',
|
|
|
|
'simple2==3.0',
|
|
|
|
)
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('list')
|
2013-02-16 02:00:59 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_local_flag(script, data):
|
2011-03-19 19:30:56 +01:00
|
|
|
"""
|
2012-09-13 00:57:41 +02: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
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('list', '--local')
|
2013-02-16 02:00:59 +01:00
|
|
|
assert 'simple (1.0)' in result.stdout
|
2012-09-13 00:57:41 +02:00
|
|
|
|
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
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_uptodate_flag(script, data):
|
2012-09-13 02:09:07 +02:00
|
|
|
"""
|
|
|
|
Test the behavior of --uptodate flag in the list command
|
|
|
|
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
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
|
2013-02-16 02:00:59 +01:00
|
|
|
assert 'simple2 (3.0)' in result.stdout, str(result)
|
2012-09-13 02:09:07 +02:00
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_outdated_flag(script, data):
|
2012-09-13 00:57:41 +02:00
|
|
|
"""
|
|
|
|
Test the behavior of --outdated flag in the list command
|
|
|
|
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
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',
|
|
|
|
)
|
2013-02-16 02:00:59 +01:00
|
|
|
assert 'simple (Current: 1.0 Latest: 3.0)' in result.stdout
|
2014-01-28 15:17:51 +01:00
|
|
|
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
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_editables_flag(script, data):
|
2012-12-18 06:34:37 +01:00
|
|
|
"""
|
|
|
|
Test the behavior of --editables flag in the list command
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', '-e',
|
|
|
|
'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
|
|
|
|
)
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('list', '--editable')
|
2013-02-16 02:00:59 +01:00
|
|
|
assert 'simple (1.0)' not in result.stdout, str(result)
|
2014-01-28 15:17:51 +01:00
|
|
|
assert os.path.join('src', 'pip-test-package') in result.stdout, (
|
|
|
|
str(result)
|
|
|
|
)
|