I have integrate my python default logger with raven . Now my errors are being logged on sentry.io/my_app. But I wanted to ask is there any way we can write unit tests for this function that generates an error and then somehow confirm that this error exits on sentry.
In Raven-Python you can implement a custom transport to swap out the HTTP request for a simple callback. This is done by implementing an abstract class for which there does not exist a lot of documentation unfortunately and the data you get is a bytestring of json-encoded data. You can find the abstract class here: https://github.com/getsentry/raven-python/blob/285b257cf386bfac78f6fe334c9044af65f98561/raven/transport/base.py#L26
This is slightly easier in the new SDK where you can write (without providing a DSN):
events = []
init(transport=events.append)
to collect events into an array instead of sending them to a server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With