Skip to content

Commit 2e23931

Browse files
authored
Fixed pymongo tests (#3839)
1 parent de7e58b commit 2e23931

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tests/integrations/pymongo/test_pymongo.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22

3-
from sentry_sdk import capture_message, start_transaction
3+
import sentry_sdk
44
from sentry_sdk.consts import SPANDATA
55
from sentry_sdk.integrations.pymongo import PyMongoIntegration, _strip_pii
66

@@ -37,7 +37,7 @@ def test_transactions(sentry_init, capture_events, mongo_server, with_pii):
3737

3838
connection = MongoClient(mongo_server.uri)
3939

40-
with start_transaction():
40+
with sentry_sdk.start_span():
4141
list(
4242
connection["test_db"]["test_collection"].find({"foobar": 1})
4343
) # force query execution
@@ -119,13 +119,9 @@ def test_breadcrumbs(
119119
list(
120120
connection["test_db"]["test_collection"].find({"foobar": 1})
121121
) # force query execution
122-
capture_message("hi")
123-
124-
if traces_sample_rate:
125-
event = events[1]
126-
else:
127-
event = events[0]
122+
sentry_sdk.capture_message("hi")
128123

124+
(event,) = events
129125
(crumb,) = event["breadcrumbs"]["values"]
130126

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

451447
connection = MongoClient(mongo_server.uri)
452448

453-
with start_transaction():
449+
with sentry_sdk.start_span():
454450
list(
455451
connection["test_db"]["test_collection"].find({"foobar": 1})
456452
) # force query execution

0 commit comments

Comments
 (0)