lib: dont send any sentry events when testing

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-01-01 18:56:14 +01:00
parent 0ef8edc9f1
commit 3eed7bb010
2 changed files with 2 additions and 2 deletions

View File

@ -114,6 +114,6 @@ def before_send(event: dict, hint: dict) -> Optional[dict]:
]:
return 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 event

View File

@ -13,4 +13,4 @@ class TestSentry(TestCase):
def test_error_sent(self):
"""Test error sent"""
self.assertEqual({}, before_send({}, {"exc_info": (0, ValueError(), 0)}))
self.assertEqual(None, before_send({}, {"exc_info": (0, ValueError(), 0)}))