Skip to content

Commit

Permalink
include metadata version in "unknown metadata" error message
Browse files Browse the repository at this point in the history
I thought this would be nice just to help people debug things in the
future.
  • Loading branch information
jfly authored and abn committed Mar 24, 2024
1 parent c8ece56 commit 8b9cf46
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/poetry/inspection/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def _from_distribution(
if dist.metadata_version not in pkginfo.distribution.HEADER_ATTRS:
# This check can be replaced once upstream implements strict parsing
# https://bugs.launchpad.net/pkginfo/+bug/2058697
raise ValueError("Unknown metadata version")
raise ValueError(f"Unknown metadata version: {dist.metadata_version}")

requirements = cls._requirements_from_distribution(dist)

Expand Down
2 changes: 1 addition & 1 deletion tests/inspection/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def test_info_from_wheel_metadata_version_unknown(
with pytest.raises(PackageInfoError) as e:
PackageInfo.from_wheel(path)

assert "Unknown metadata version" in str(e.value)
assert "Unknown metadata version: 999.3" in str(e.value)


def test_info_from_wheel_metadata(demo_wheel_metadata: RawMetadata) -> None:
Expand Down

0 comments on commit 8b9cf46

Please sign in to comment.