Repository navigation
fix(source add): report an invalid --priority instead of failing with KeyError - #11175
Merged
radoering merged 1 commit intoOct 28, 2026
Merged
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
radoering
approved these changes
Oct 28, 2026
radoering
force-pushed
the
fix/source-add-invalid-priority
branch
from
October 28, 2026 03:56
eff0dc2 to
e6f8ff5
Compare
radoering
enabled auto-merge (squash)
October 28, 2026 03:57
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Resolves #11174.
poetry source addlooks the--priorityvalue up in thePriorityenum (src/poetry/console/commands/source/add.py), so an unknown value raises aKeyErrorthat Cleo prints as the bare string:Exit code 1, with no hint about the valid values, although the command's own
--helplists them and its other two failure paths (Source with name ... already exists,Source ... is not a valid URL) report themselves in plain language.The lookup is now wrapped and reports the same kind of message as the neighbouring error paths:
--priority=Supplementalstill works, since the value is upper-cased before the lookup, and the valid values are listed from the enum so the message cannot drift from the accepted set.tests/console/commands/source/test_add.py::test_source_add_error_invalid_priorityfails on the current tree withKeyError: 'BOGUS'and passes with the change; the file is 15 passed.ruff check,ruff format --checkandmypyare clean on the changed file. The integration tests were not run here.Prepared with AI assistance (DeepSeek Harness, dsv41 agent); every line was verified by running the cases above.