-
Notifications
You must be signed in to change notification settings - Fork 3.1k
12446 - better error msg for missing METADATA file #13402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
eevelweezel
wants to merge
6
commits into
pypa:main
Choose a base branch
from
eevelweezel:12446-missing-metadata
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d94984c
better error msg for missing METADATA file
eevelweezel a233e53
add news
eevelweezel 40e92b5
fix message, add test
eevelweezel 693fba7
Merge branch 'pypa:main' into 12446-missing-metadata
eevelweezel 67dec1c
debug windows
eevelweezel 1403681
fix test case
eevelweezel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
improve error message shown when pkg.dist-info encounters a missing METADATA file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -765,3 +765,22 @@ def test_list_wheel_build(script: PipTestEnvironment) -> None: | |
result = script.pip("list") | ||
assert "Build" in result.stdout, str(result) | ||
assert "123" in result.stdout, str(result) | ||
|
||
|
||
def test_list_missing_metadata_warning(script: PipTestEnvironment) -> None: | ||
""" | ||
Test that a warning is shown when a dist-info directory is missing the | ||
METADATA file. | ||
""" | ||
# Create a .dist-info dir without METADATA file | ||
dist_info_path = script.site_packages_path / "foo-1.0.dist-info" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bug report shows a reproducer that is missing the version and I can't reproduce this EXCEPT with an invalid .dist-info name. I think the initial bug report is in error. I will comment on the ticket itself. |
||
dist_info_path.mkdir() | ||
|
||
# pip list should warn about missing .dist-info/METADATA | ||
result = script.pip("list", allow_stderr_warning=True) | ||
print(str(result.stdout)) | ||
print(str(result.stderr)) | ||
print(dir(result)) | ||
|
||
assert "Skipping" in result.stderr | ||
assert "missing `METADATA` file" in result.stderr |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't only get
name
equal toNone
when there's a missingMETADATA
file, we also get it when the.dist-info
directory's name is incorrect - i.e., not in the form{name}-{version}.dist-info
. There's also the possibility of a failure inget_info_location
that isn't a missingMETADATA
file, as well as a.egg-info
file with no stem (although that possibility seems very unlikely to me)If we want to give a more informative message, we'll need to somehow distinguish the various possible failure cases in
parse_name_and_version_from_info_directory
.