8
8
9
9
from tests .conftest import patch_start_tracing_child
10
10
11
+ import sentry_sdk
11
12
from sentry_sdk import (
12
13
push_scope ,
13
14
configure_scope ,
@@ -220,7 +221,7 @@ def before_breadcrumb(crumb, hint):
220
221
events = capture_events ()
221
222
222
223
monkeypatch .setattr (
223
- Hub . current . client .transport , "record_lost_event" , record_lost_event
224
+ sentry_sdk . get_client () .transport , "record_lost_event" , record_lost_event
224
225
)
225
226
226
227
def do_this ():
@@ -269,7 +270,7 @@ def test_option_enable_tracing(
269
270
updated_traces_sample_rate ,
270
271
):
271
272
sentry_init (enable_tracing = enable_tracing , traces_sample_rate = traces_sample_rate )
272
- options = Hub . current . client .options
273
+ options = sentry_sdk . get_client () .options
273
274
assert has_tracing_enabled (options ) is tracing_enabled
274
275
assert options ["traces_sample_rate" ] == updated_traces_sample_rate
275
276
@@ -311,6 +312,9 @@ def test_push_scope(sentry_init, capture_events):
311
312
312
313
313
314
def test_push_scope_null_client (sentry_init , capture_events ):
315
+ """
316
+ This test can be removed when we remove push_scope and the Hub from the SDK.
317
+ """
314
318
sentry_init ()
315
319
events = capture_events ()
316
320
@@ -331,6 +335,9 @@ def test_push_scope_null_client(sentry_init, capture_events):
331
335
)
332
336
@pytest .mark .parametrize ("null_client" , (True , False ))
333
337
def test_push_scope_callback (sentry_init , null_client , capture_events ):
338
+ """
339
+ This test can be removed when we remove push_scope and the Hub from the SDK.
340
+ """
334
341
sentry_init ()
335
342
336
343
if null_client :
@@ -439,6 +446,9 @@ def test_integration_scoping(sentry_init, capture_events):
439
446
reason = "This test is not valid anymore, because with the new Scopes calling bind_client on the Hub sets the client on the global scope. This test should be removed once the Hub is removed"
440
447
)
441
448
def test_client_initialized_within_scope (sentry_init , caplog ):
449
+ """
450
+ This test can be removed when we remove push_scope and the Hub from the SDK.
451
+ """
442
452
caplog .set_level (logging .WARNING )
443
453
444
454
sentry_init ()
@@ -455,6 +465,9 @@ def test_client_initialized_within_scope(sentry_init, caplog):
455
465
reason = "This test is not valid anymore, because with the new Scopes the push_scope just returns the isolation scope. This test should be removed once the Hub is removed"
456
466
)
457
467
def test_scope_leaks_cleaned_up (sentry_init , caplog ):
468
+ """
469
+ This test can be removed when we remove push_scope and the Hub from the SDK.
470
+ """
458
471
caplog .set_level (logging .WARNING )
459
472
460
473
sentry_init ()
@@ -475,6 +488,9 @@ def test_scope_leaks_cleaned_up(sentry_init, caplog):
475
488
reason = "This test is not valid anymore, because with the new Scopes there is not pushing and popping of scopes. This test should be removed once the Hub is removed"
476
489
)
477
490
def test_scope_popped_too_soon (sentry_init , caplog ):
491
+ """
492
+ This test can be removed when we remove push_scope and the Hub from the SDK.
493
+ """
478
494
caplog .set_level (logging .ERROR )
479
495
480
496
sentry_init ()
@@ -719,7 +735,7 @@ def test_functions_to_trace_with_class(sentry_init, capture_events):
719
735
def test_redis_disabled_when_not_installed (sentry_init ):
720
736
sentry_init ()
721
737
722
- assert Hub . current .get_integration (RedisIntegration ) is None
738
+ assert sentry_sdk . get_client () .get_integration (RedisIntegration ) is None
723
739
724
740
725
741
def test_multiple_setup_integrations_calls ():
0 commit comments