File tree 3 files changed +24
-0
lines changed
3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,8 @@ def __copy__(self):
244
244
245
245
rv ._profile = self ._profile
246
246
247
+ rv ._last_event_id = self ._last_event_id
248
+
247
249
return rv
248
250
249
251
@classmethod
Original file line number Diff line number Diff line change 17
17
start_transaction ,
18
18
last_event_id ,
19
19
add_breadcrumb ,
20
+ isolation_scope ,
20
21
Hub ,
21
22
Scope ,
22
23
)
@@ -800,3 +801,11 @@ def test_last_event_id_transaction(sentry_init):
800
801
pass
801
802
802
803
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 19
19
)
20
20
21
21
22
+ SLOTS_NOT_COPIED = {"client" }
23
+ """__slots__ that are not copied when copying a Scope object."""
24
+
25
+
22
26
def test_copying ():
23
27
s1 = Scope ()
24
28
s1 .fingerprint = {}
@@ -34,6 +38,15 @@ def test_copying():
34
38
assert s1 ._fingerprint is s2 ._fingerprint
35
39
36
40
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
+
37
50
def test_merging (sentry_init , capture_events ):
38
51
sentry_init ()
39
52
You can’t perform that action at this time.
0 commit comments