Skip to content

Commit

Permalink
Fixed pymongo tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Dec 3, 2024
1 parent a962fab commit b36a759
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tests/integrations/pymongo/test_pymongo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re

from sentry_sdk import capture_message, start_transaction
import sentry_sdk
from sentry_sdk.consts import SPANDATA
from sentry_sdk.integrations.pymongo import PyMongoIntegration, _strip_pii

Expand Down Expand Up @@ -37,7 +37,7 @@ def test_transactions(sentry_init, capture_events, mongo_server, with_pii):

connection = MongoClient(mongo_server.uri)

with start_transaction():
with sentry_sdk.start_span():
list(
connection["test_db"]["test_collection"].find({"foobar": 1})
) # force query execution
Expand Down Expand Up @@ -119,13 +119,9 @@ def test_breadcrumbs(
list(
connection["test_db"]["test_collection"].find({"foobar": 1})
) # force query execution
capture_message("hi")

if traces_sample_rate:
event = events[1]
else:
event = events[0]
sentry_sdk.capture_message("hi")

(event,) = events
(crumb,) = event["breadcrumbs"]["values"]

assert crumb["category"] == "query"
Expand Down Expand Up @@ -450,7 +446,7 @@ def test_span_origin(sentry_init, capture_events, mongo_server):

connection = MongoClient(mongo_server.uri)

with start_transaction():
with sentry_sdk.start_span():
list(
connection["test_db"]["test_collection"].find({"foobar": 1})
) # force query execution
Expand Down

0 comments on commit b36a759

Please sign in to comment.