Mocking or stubbing Sentry for testing #5207
Unanswered
jenstroeger
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
If I wanted to test code that’s been instrumented by Sentry, or if I wanted to test that my own filters work as expected, then I would want to run tests without Sentry actually sending off anything. (Related discussion #4499.)
There’s some documentation here on passing a custom Transport object when initializing Sentry, but there’s not much information on subclassing Transports. Reading the code it seems the capture_envelope() methods needs to be overridden:
However, when I initialize Sentry
and then trigger an error
I had expected the
print()output but that didn’t happen.What am I missing here? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions