diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 54e6fc8928..f03827b30d 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -202,6 +202,7 @@ def __copy__(self): rv = object.__new__(self.__class__) # type: Scope rv._type = self._type + rv.client = self.client rv._level = self._level rv._name = self._name rv._fingerprint = self._fingerprint diff --git a/tests/test_scope.py b/tests/test_scope.py index 48b8782190..316b9ed335 100644 --- a/tests/test_scope.py +++ b/tests/test_scope.py @@ -23,6 +23,7 @@ use_scope, use_isolation_scope, ) +from tests.conftest import ApproxDict SLOTS_NOT_COPIED = {"client"} @@ -806,8 +807,8 @@ def test_nested_scopes_with_tags(sentry_init, capture_envelopes): transaction = envelope.items[0].get_transaction_event() assert transaction["tags"] == {"isolation_scope1": 1, "current_scope2": 1, "trx": 1} - assert transaction["spans"][0]["tags"] == {"a": 1} - assert transaction["spans"][1]["tags"] == {"b": 1} + assert transaction["spans"][0]["tags"] == ApproxDict({"a": 1}) + assert transaction["spans"][1]["tags"] == ApproxDict({"b": 1}) def test_should_send_default_pii_true(sentry_init):