tonyandrewmeyer/charming-with-claude/testing-exception-wrapping
Claude Code and agent skill by tonyandrewmeyer/charming-with-claude
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install tonyandrewmeyer/charming-with-claude/testing-exception-wrappingSKILL.md
The same SKILL.md was published earlier as tonyandrewmeyer/charming-with-claude/testing-exception-wrapping.
Skill: Adopt SCENARIO_BARE_CHARM_ERRORS
Enable bare exception propagation in ops.testing so that charm exceptions surface directly instead of being wrapped in UncaughtCharmError.
When to Use
Use this when a charm has unit tests using ops.testing and you want cleaner tracebacks and more natural exception assertions.
Prerequisites
- ops >= 3.5.0
- The charm has unit tests using
ops.testing
Step 1: Check Current Exception Handling
Search test files for:
UncaughtCharmError— tests catching the wrappere.__cause__— tests unwrapping to get the original exception- Broad
except Exceptionin test code aroundctx.run()calls
Step 2: Set the Environment Variable
Add SCENARIO_BARE_CHARM_ERRORS=true to the test environment.
In tox.ini:
Or in pyproject.toml (if using pytest directly):
Step 3: Update Affected Tests
Tests catching UncaughtCharmError
Tests that don't check exceptions
Tests that don't catch UncaughtCharmError are unaffected — they'll just get better tracebacks when things go wrong.
Step 4: Verify
- Run
tox -e unit— all tests should pass. - Intentionally break something and verify the traceback is cleaner (shows the original exception directly).
Exemplar Charms
No downstream charm has adopted this yet. Reference:
- [canonical/operator](https://github.com/canonical/operator) (tox.ini) — ops' own tests use this env var.
Common Mistakes
- Don't set this in production code — it's a testing-only environment variable.
- Don't forget to update tests that explicitly catch
UncaughtCharmError— they'll start failing because the exception type changes. - The variable name is
SCENARIO_BARE_CHARM_ERRORS(legacy name from the ops-scenario era) — don't misspell it.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingexperiments/2026-01-25-ops-upgrade/skills/testing-exception-wrapping/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tonyandrewmeyer/charming-with-claude/testing-exception-wrapping)