lib: dont send any sentry events when testing
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
0ef8edc9f1
commit
3eed7bb010
|
@ -114,6 +114,6 @@ def before_send(event: dict, hint: dict) -> Optional[dict]:
|
||||||
]:
|
]:
|
||||||
return None
|
return None
|
||||||
LOGGER.debug("sending event to sentry", exc=exc_value, source_logger=event.get("logger", None))
|
LOGGER.debug("sending event to sentry", exc=exc_value, source_logger=event.get("logger", None))
|
||||||
if settings.DEBUG:
|
if settings.DEBUG or settings.TEST:
|
||||||
return None
|
return None
|
||||||
return event
|
return event
|
||||||
|
|
|
@ -13,4 +13,4 @@ class TestSentry(TestCase):
|
||||||
|
|
||||||
def test_error_sent(self):
|
def test_error_sent(self):
|
||||||
"""Test error sent"""
|
"""Test error sent"""
|
||||||
self.assertEqual({}, before_send({}, {"exc_info": (0, ValueError(), 0)}))
|
self.assertEqual(None, before_send({}, {"exc_info": (0, ValueError(), 0)}))
|
||||||
|
|
Reference in New Issue