Skip to content

Commit 4276f44

Browse files
authored
Make usage of Python SDK future proof (#3714)
Fixes problems that appear when Python SDK 3.0 will be released.
1 parent 5173b31 commit 4276f44

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

_integration-test/test_01_basics.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ def test_login(client_login):
123123
def test_receive_event(client_login):
124124
event_id = None
125125
client, _ = client_login
126-
with sentry_sdk.init(dsn=get_sentry_dsn(client)):
127-
event_id = sentry_sdk.capture_exception(Exception("a failure"))
126+
127+
sentry_sdk.init(dsn=get_sentry_dsn(client))
128+
129+
event_id = sentry_sdk.capture_exception(Exception("a failure"))
128130
assert event_id is not None
129131
response = poll_for_response(
130132
f"{SENTRY_TEST_HOST}/api/0/projects/sentry/internal/events/{event_id}/", client
@@ -377,18 +379,19 @@ def test_custom_certificate_authorities():
377379

378380
def test_receive_transaction_events(client_login):
379381
client, _ = client_login
380-
with sentry_sdk.init(
382+
sentry_sdk.init(
381383
dsn=get_sentry_dsn(client), profiles_sample_rate=1.0, traces_sample_rate=1.0
382-
):
384+
)
385+
386+
def placeholder_fn():
387+
sum = 0
388+
for i in range(5):
389+
sum += i
390+
time.sleep(0.25)
383391

384-
def placeholder_fn():
385-
sum = 0
386-
for i in range(5):
387-
sum += i
388-
time.sleep(0.25)
392+
with sentry_sdk.start_transaction(op="task", name="Test Transactions"):
393+
placeholder_fn()
389394

390-
with sentry_sdk.start_transaction(op="task", name="Test Transactions"):
391-
placeholder_fn()
392395
poll_for_response(
393396
f"{SENTRY_TEST_HOST}/api/0/organizations/sentry/events/?dataset=profiles&field=profile.id&project=1&statsPeriod=1h",
394397
client,

0 commit comments

Comments
 (0)