@@ -83,22 +83,15 @@ def pytest_bdd_before_scenario(request, feature, scenario):
83
83
if tracer is None :
84
84
return
85
85
86
- span = tracer .start_span (
87
- scenario .name ,
88
- span_type = "scenario" ,
89
- child_of = tracer .current_trace_context (),
90
- activate = True ,
91
- )
92
- setattr (scenario , "__dd_span__" , span )
86
+ span = tracer .current_span ()
87
+ span .set_tag ("test.name" , scenario .name )
88
+ span .set_tag ("test.suite" , scenario .feature .filename .split ("tests" )[- 1 ])
93
89
94
90
95
91
def pytest_bdd_after_scenario (request , feature , scenario ):
96
92
ctx = request .getfixturevalue ("context" )
97
93
for undo in reversed (ctx ["undo_operations" ]):
98
94
undo ()
99
- span = getattr (scenario , "__dd_span__" , None )
100
- if span is not None :
101
- span .finish ()
102
95
103
96
104
97
def pytest_bdd_before_step (request , feature , scenario , step , step_func ):
@@ -109,7 +102,7 @@ def pytest_bdd_before_step(request, feature, scenario, step, step_func):
109
102
step .type ,
110
103
resource = step .name ,
111
104
span_type = step .type ,
112
- child_of = getattr ( scenario , "__dd_span__" ),
105
+ child_of = tracer . current_span ( ),
113
106
activate = True ,
114
107
)
115
108
setattr (step_func , "__dd_span__" , span )
@@ -610,7 +603,9 @@ def execute_request(undo, context, client, api_version, _package):
610
603
operation_id = api_request ["request" ].__name__
611
604
response = api_request ["response" ][0 ]
612
605
613
- context ["undo_operations" ].append (lambda : undo (api , api_version , operation_id , response ))
606
+ context ["undo_operations" ].append (
607
+ lambda : undo (api , api_version , operation_id , response )
608
+ )
614
609
615
610
616
611
@then (parsers .parse ('I should get an instance of "{name}"' ))
0 commit comments