File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,8 @@ def __copy__(self):
244244
245245 rv ._profile = self ._profile
246246
247+ rv ._last_event_id = self ._last_event_id
248+
247249 return rv
248250
249251 @classmethod
Original file line number Diff line number Diff line change 1717 start_transaction ,
1818 last_event_id ,
1919 add_breadcrumb ,
20+ isolation_scope ,
2021 Hub ,
2122 Scope ,
2223)
@@ -800,3 +801,11 @@ def test_last_event_id_transaction(sentry_init):
800801 pass
801802
802803 assert last_event_id () is None , "Transaction should not set last_event_id"
804+
805+
806+ def test_last_event_id_scope (sentry_init ):
807+ sentry_init (enable_tracing = True )
808+
809+ # Should not crash
810+ with isolation_scope () as scope :
811+ assert scope .last_event_id () is None
Original file line number Diff line number Diff line change 1919)
2020
2121
22+ SLOTS_NOT_COPIED = {"client" }
23+ """__slots__ that are not copied when copying a Scope object."""
24+
25+
2226def test_copying ():
2327 s1 = Scope ()
2428 s1 .fingerprint = {}
@@ -34,6 +38,15 @@ def test_copying():
3438 assert s1 ._fingerprint is s2 ._fingerprint
3539
3640
41+ def test_all_slots_copied ():
42+ scope = Scope ()
43+ scope_copy = copy .copy (scope )
44+
45+ # Check all attributes are copied
46+ for attr in set (Scope .__slots__ ) - SLOTS_NOT_COPIED :
47+ assert getattr (scope_copy , attr ) == getattr (scope , attr )
48+
49+
3750def test_merging (sentry_init , capture_events ):
3851 sentry_init ()
3952
You can’t perform that action at this time.
0 commit comments