tests: add reproducer for dev multipass version causing InvalidVersion (#1917)#2668
Draft
tests: add reproducer for dev multipass version causing InvalidVersion (#1917)#2668
Conversation
Add a failing test that demonstrates that charmcraft's provider service does not handle packaging.version.InvalidVersion raised by craft-providers when the installed multipass has a non-PEP-440 dev version string such as '1.15.0-dev.2929.pr661+gc67ef6641.mac'. The exception propagates as an unhandled internal error instead of being converted to a user-friendly CraftError. Closes #1917 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Type checking with Command output |
Collaborator
Author
…ftError Agent-Logs-Url: https://github.com/canonical/charmcraft/sessions/3a926400-ec3b-4778-938f-31fffbdb43d6 Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
Contributor
Fixed in 177e89a. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a failing unit test that reproduces #1917: when multipass has a dev version string like
1.15.0-dev.2929.pr661+gc67ef6641.mac, charmcraft crashes with an unhandledpackaging.version.InvalidVersioninternal error.Bug
The root cause is in
craft_providers:multipass.is_supported_version()callspackaging.version.parse()which raisesInvalidVersionfor non-PEP-440 strings. Charmcraft'sProviderService.instance()does not catch this exception, so it propagates as an internal error.Upstream bug: canonical/craft-providers#661
The fix in charmcraft would be to catch
InvalidVersioninProviderService.instance()and convert it to a user-friendlyCraftError.Reproducer
The test fails with:
Closes #1917