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.

(cherry picked from commit 8b9cf46)
  • Loading branch information
jfly authored and radoering committed Apr 12, 2024
1 parent 717b6c3 commit d0abffb
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 @@ -248,7 +248,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 = None

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 @@ -190,7 +190,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 d0abffb

Please sign in to comment.