-
Notifications
You must be signed in to change notification settings - Fork 261
Package metadata: give more-descriptive error when license file not found #827
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
Package metadata: give more-descriptive error when license file not found #827
Conversation
Reviewer's Guide by SourceryThis pull request improves error handling when a license file is not found. Instead of failing silently, it now raises a FileNotFoundError with a descriptive message, which includes the absolute path of the missing file. Additionally, a test case was added to verify this new behavior. Sequence diagram for improved license file handlingsequenceDiagram
participant Factory as Factory._configure_package_metadata
participant FS as File System
Factory->>FS: Check if license_path exists
alt License file not found
FS-->>Factory: File does not exist
Factory->>Factory: Raise FileNotFoundError with detailed message
else License file exists
FS-->>Factory: File exists
Factory->>FS: Read license file content
FS-->>Factory: Return license text
Factory->>Factory: Process license text
end
Flow diagram for license file processingflowchart TD
A[Start license processing] --> B{Has license file path?}
B -->|No| C[Use raw license text]
B -->|Yes| D{Check if file exists}
D -->|No| E[Raise FileNotFoundError]
D -->|Yes| F[Read license file]
F --> G[Process license content]
C --> G
G --> H[End]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @MaddyGuthridge - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟡 Security: 1 issue found
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
3d56aba
to
f774027
Compare
Co-authored-by: Randy Döring <30527984+radoering@users.noreply.github.com>
Resolves: python-poetry#10105
This is a second (much simpler) attempt at solving this issue. My first can be found at #825, and is massively more complex.
This time, the change is in
Factory._configure_package_metadata
, and just adds aFileNotFoundError
exception. Much easier to comprehend.One thing I want to check is how this error is reported by poetry's main CLI. I want to make sure that the detail of the error is properly conveyed in the CLI. Does anyone have advice on how I can test my modifications against the Poetry CLI?
Summary by Sourcery
Raise a FileNotFoundError when the license file specified in pyproject.toml is not found.
Bug Fixes:
Tests: