tests: add reproducer for upload crash outside project directory (#2492)#2665
tests: add reproducer for upload crash outside project directory (#2492)#2665
Conversation
Add a failing test that demonstrates that UploadCommand.run() crashes
with RuntimeError('Project not configured yet.') when invoked from
outside a directory containing a charmcraft.yaml.
The upload itself succeeds, but the post-upload project lookup raises
an unhandled RuntimeError that surfaces as an internal error.
Closes #2492
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Type checking with Command output |
Agent-Logs-Url: https://github.com/canonical/charmcraft/sessions/7f16d908-0cca-4307-9d78-e77c3a114b21 Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
Fixed in commit 80f7efa. The bug was in The fix wraps that call in a |
Summary
Adds a failing unit test that reproduces #2492:
charmcraft uploadcrashes with an internalRuntimeErrorwhen run from outside a charm project directory.Bug
UploadCommand.run()callsself._services.get("project").get()unconditionally at line 586 after a successful upload. When nocharmcraft.yamlis present in the current directory, the project service raisesRuntimeError('Project not configured yet.')— this propagates as an unhandled internal error instead of completing gracefully.Reproducer
The test fails with:
Closes #2492