8000 Fix pymongo tests in POTel by antonpirker · Pull Request #3839 · getsentry/sentry-python · GitHub
[go: up one dir, main page]

Skip to content

Fix pymongo tests in POTel #3839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading
0