From fa8aad12b529228abe6211b16d7d7cc3986d18ee Mon Sep 17 00:00:00 2001 From: shimpeko Date: Fri, 16 Dec 2022 15:24:27 +0000 Subject: [PATCH] [fix] `update --outdated` raises NonExistentKey with dev package closes https://github.com/pypa/pipenv/issues/5540 This PR fixed https://github.com/pypa/pipenv/issues/5540 --- pipenv/core.py | 2 +- pyproject.toml | 1 + tests/integration/test_update.py | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/integration/test_update.py diff --git a/pipenv/core.py b/pipenv/core.py index 771e8eea7b..1fda7fe381 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -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"]) diff --git a/pyproject.toml b/pyproject.toml index 3b12f890ba..5c0eb6cdf3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/tests/integration/test_update.py b/tests/integration/test_update.py new file mode 100644 index 0000000000..43d452bfaa --- /dev/null +++ b/tests/integration/test_update.py @@ -0,0 +1,11 @@ +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 -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