Skip to content

Commit

Permalink
[fix] update --outdated raises NonExistentKey with dev package
Browse files Browse the repository at this point in the history
closes pypa#5540

pipenv update --outdated fail with NonExistentKey error when there are
outdated packages in dev-packages category.
  • Loading branch information
shimpeko committed Dec 16, 2022
1 parent 581f0bf commit 4fa140d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/5540.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix: `update --outdated` raises NonExistentKey with outdated dev packages
2 changes: 1 addition & 1 deletion pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ def do_outdated(project, pypi_mirror=None, pre=False, clear=False):
)
if name_in_pipfile:
required = ""
version = get_version(project.packages[name_in_pipfile])
version = get_version(project.get_pipfile_section(category)[name_in_pipfile])
rdeps = reverse_deps.get(canonicalize_name(package))
if isinstance(rdeps, Mapping) and "required" in rdeps:
required = " {} required".format(rdeps["required"])
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ filterwarnings = [
# `pipenv run pytest --markers` will list all markers inlcuding these
markers = [
"install: tests having to do with `pipenv install`",
"update: tests having to do with `pipenv update`",
"needs_internet: integration tests that require internet to pass",
"basic: basic pipenv tests grouping",
"dev: tests having to do with dev and dev packages",
Expand Down
21 changes: 21 additions & 0 deletions tests/integration/test_update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest

@pytest.mark.basic
@pytest.mark.update
def test_update_outdated(pipenv_instance_private_pypi):
with pipenv_instance_private_pypi() as p:
package_name = "six"
p.pipenv("install {}~=1.15".format(package_name))
c = p.pipenv("update --outdated")
assert c.stdout_bytes.decode("utf-8").startswith("Package {} out-of-date:".format(package_name))
assert c.returncode == 0

@pytest.mark.basic
@pytest.mark.update
def test_update_outdated_with_outdated_dev_package(pipenv_instance_private_pypi):
with pipenv_instance_private_pypi() as p:
package_name = "six"
p.pipenv("install -d {}~=1.15".format(package_name))
c = p.pipenv("update --outdated")
assert c.stdout_bytes.decode("utf-8").startswith("Package {} out-of-date:".format(package_name))
assert c.returncode == 0

0 comments on commit 4fa140d

Please sign in to comment.