pip list --not-required --outdated should list only outdated packages that are not dependencies of installed packages

This commit is contained in:
Peter Lisák 2019-01-05 21:58:16 +01:00
parent 740b1acf90
commit 4f35981085
3 changed files with 20 additions and 3 deletions

1
news/5737.bugfix Normal file
View File

@ -0,0 +1 @@
`pip list --outdated --not-required` should list only outdated packages that are not dependencies of installed packages

View File

@ -134,14 +134,14 @@ class ListCommand(Command):
include_editables=options.include_editable,
)
if options.not_required:
packages = self.get_not_required(packages, options)
if options.outdated:
packages = self.get_outdated(packages, options)
elif options.uptodate:
packages = self.get_uptodate(packages, options)
if options.not_required:
packages = self.get_not_required(packages, options)
self.output_package_listing(packages, options)
def get_outdated(self, packages, options):

View File

@ -384,6 +384,22 @@ def test_outdated_editables_columns_flag(script, data):
)
@pytest.mark.network
def test_outdated_not_required_flag(script, data):
"""
test the behavior of --outdated --not-required flag in the list command
"""
script.pip(
'install', '-f', data.find_links, '--no-index',
'simple==2.0', 'require_simple==1.0'
)
result = script.pip(
'list', '-f', data.find_links, '--no-index', '--outdated',
'--not-required', '--format=json',
)
assert [] == json.loads(result.stdout)
def test_outdated_pre(script, data):
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')