File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ strict_optional = true
6666warn_redundant_casts = true
6767warn_unused_configs = true
6868warn_unused_ignores = true
69+ exclude = [" tests/" ]
6970
7071# Relaxations for code written before mypy was introduced
7172# Do not use wildcards in module paths, otherwise added modules will
Original file line number Diff line number Diff line change @@ -509,3 +509,36 @@ def test_transaction_not_started_warning(sentry_init):
509509 "The transaction will not be sent to Sentry. To fix, start the transaction by"
510510 "passing it to sentry_sdk.start_transaction."
511511 )
512+
513+
514+ def test_span_set_data (sentry_init , capture_events ):
515+ sentry_init (traces_sample_rate = 1.0 )
516+
517+ events = capture_events ()
518+
519+ with sentry_sdk .start_transaction (name = "test-transaction" ):
520+ with start_span (op = "test-span" ) as span :
521+ span .set_data ("key0" , "value0" )
522+ span .set_data ("key1" , "value1" )
523+
524+ span .set_data (
525+ {
526+ "key1" : "updated-value1" ,
527+ "key2" : "value2" ,
528+ "key3" : "value3" ,
529+ }
530+ )
531+
532+ span .set_data (None )
533+
534+ (event ,) = events
535+ span = event ["spans" ][0 ]
536+
537+ assert span ["data" ] == {
538+ "key0" : "value0" ,
539+ "key1" : "updated-value1" ,
540+ "key2" : "value2" ,
541+ "key3" : "value3" ,
542+ "thread.id" : mock .ANY ,
543+ "thread.name" : mock .ANY ,
544+ }
You can’t perform that action at this time.
0 commit comments