Add functional test for 'list --no-deps-only' option.

This commit is contained in:
nvdv 2016-09-30 15:07:10 +03:00
parent 60429a6e79
commit bb896cb44c
2 changed files with 13 additions and 5 deletions

View File

@ -183,13 +183,10 @@ class ListCommand(Command):
]
def get_nodeps_only(self, packages, options):
installed_pkgs = [
dist for dist in self.iter_packages_latest_infos(packages, options)
]
dep_keys = set()
for dist in installed_pkgs:
for dist in packages:
dep_keys.update(requirement.key for requirement in dist.requires())
return set(pkg for pkg in installed_pkgs if pkg.key not in dep_keys)
return set(pkg for pkg in packages if pkg.key not in dep_keys)
def iter_packages_latest_infos(self, packages, options):
index_urls = [options.index_url] + options.extra_index_urls

View File

@ -564,6 +564,17 @@ def test_outdated_formats(script, data):
'latest_version': '1.1', 'latest_filetype': 'wheel'}]
def test_no_deps_only_flag(script, data):
script.pip(
'install', '-f', data.find_links, '--no-index', 'TopoRequires4'
)
result = script.pip('list', '--no-deps-only', expect_stderr=True)
assert 'TopoRequires4 ' in result.stdout, str(result)
assert 'TopoRequires ' not in result.stdout
assert 'TopoRequires2 ' not in result.stdout
assert 'TopoRequires3 ' not in result.stdout
def test_list_freeze(script, data):
"""
Test freeze formatting of list command