Skip to content

Commit 4dab8a2

Browse files
committed
test and comment
1 parent 6495a08 commit 4dab8a2

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/test_basics.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,40 @@ def test_dedupe_event_processor_drop_records_client_report(
710710
assert lost_event_call == ("event_processor", "error", None, 1)
711711

712712

713+
def test_dedupe_doesnt_take_into_account_dropped_exception(sentry_init, capture_events):
714+
# Two exceptions happen one after another. The first one is dropped in the
715+
# user's before_send. The second one isn't.
716+
# Originally, DedupeIntegration would drop the second exception. This test
717+
# is making sure that that is no longer the case -- i.e., DedupeIntegration
718+
# doesn't consider exceptions dropped in before_send.
719+
count = 0
720+
721+
def before_send(event, hint):
722+
nonlocal count
723+
count += 1
724+
if count == 1:
725+
return None
726+
return event
727+
728+
sentry_init(before_send=before_send)
729+
events = capture_events()
730+
731+
for _ in range(2):
732+
# The first ValueError will be dropped by before_send. The second
733+
# ValueError will be accepted by before_send, and should be sent to
734+
# Sentry.
735+
try:
736+
raise ValueError("aha!")
737+
except Exception:
738+
try:
739+
capture_exception()
740+
reraise(*sys.exc_info())
741+
except Exception:
742+
capture_exception()
743+
744+
assert len(events) == 2
745+
746+
713747
def test_event_processor_drop_records_client_report(
714748
sentry_init, capture_events, capture_record_lost_event_calls
715749
):

0 commit comments

Comments
 (0)