File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1045,13 +1045,15 @@ def test_set_correlation_ids(self):
10451045 self .assertEqual (span .parent_id , int (fake_xray_header_value_parent_decimal ))
10461046 span .finish ()
10471047
1048+ @patch ("datadog_lambda.config.Config.trace_enabled" , False )
10481049 def test_set_correlation_ids_handle_empty_trace_context (self ):
1049- # neither x-ray or ddtrace is used. no tracing context at all.
1050+ # Incomplete trace context: no dummy span should be created. Do not assert
1051+ # tracer.current_span() is None — pytest's CI Visibility plugin (--ddtrace)
1052+ # keeps a root test span active for the duration of the test.
10501053 self .mock_get_dd_trace_context .return_value = Context ()
1051- # no exception thrown
1052- set_correlation_ids ()
1053- span = tracer .current_span ()
1054- self .assertIsNone (span )
1054+ with patch .object (tracer , "trace" ) as mock_trace :
1055+ set_correlation_ids ()
1056+ mock_trace .assert_not_called ()
10551057
10561058
10571059def _expected_span_pointer_link (
You can’t perform that action at this time.
0 commit comments