Skip to content

Commit

Permalink
Setup scopes before client
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py committed Jan 10, 2025
1 parent 525d156 commit b2573e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sentry_sdk/_init_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def _init(*args, **kwargs):
This takes the same arguments as the client constructor.
"""
setup_scope_context_management()
client = sentry_sdk.Client(*args, **kwargs)
sentry_sdk.get_global_scope().set_client(client)
setup_scope_context_management()
_check_python_deprecations()


Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ def inner(identifier):
@pytest.fixture
def sentry_init(request):
def inner(*a, **kw):
setup_scope_context_management()
kw.setdefault("transport", TestTransport())
client = sentry_sdk.Client(*a, **kw)
sentry_sdk.get_global_scope().set_client(client)
setup_scope_context_management()

if request.node.get_closest_marker("forked"):
# Do not run isolation if the test is already running in
Expand Down

0 comments on commit b2573e7

Please sign in to comment.