mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
63 lines
2.3 KiB
Python
63 lines
2.3 KiB
Python
import os
|
|
import re
|
|
import textwrap
|
|
from tests.lib import find_links
|
|
from tests.lib.local_repos import local_checkout
|
|
|
|
|
|
def test_list_command(script):
|
|
"""
|
|
Test default behavior of list command.
|
|
|
|
"""
|
|
script.pip('install', '-f', 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)
|
|
|
|
|
|
def test_local_flag(script):
|
|
"""
|
|
Test the behavior of --local flag in the list command
|
|
|
|
"""
|
|
script.pip('install', '-f', find_links, '--no-index', 'simple==1.0')
|
|
result = script.pip('list', '--local')
|
|
assert 'simple (1.0)' in result.stdout
|
|
|
|
|
|
def test_uptodate_flag(script):
|
|
"""
|
|
Test the behavior of --uptodate flag in the list command
|
|
|
|
"""
|
|
script.pip('install', '-f', 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', 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)
|
|
|
|
|
|
def test_outdated_flag(script):
|
|
"""
|
|
Test the behavior of --outdated flag in the list command
|
|
|
|
"""
|
|
script.pip('install', '-f', 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', 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
|
|
|
|
|
|
def test_editables_flag(script):
|
|
"""
|
|
Test the behavior of --editables flag in the list command
|
|
"""
|
|
script.pip('install', '-f', 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)
|