@@ -27,6 +27,7 @@ def _test_as_bool(env_key, conf_key, default):
2727 (env_key , conf_key , "purple" , False ),
2828 )
2929
30+
3031def _test_int (env_key , conf_key , default ):
3132 return (
3233 (env_key , conf_key , None , default ),
@@ -38,6 +39,7 @@ def _test_int(env_key, conf_key, default):
3839 (env_key , conf_key , "purple" , default ),
3940 )
4041
42+
4143def _test_as_list (env_key , conf_key , default ):
4244 return (
4345 (env_key , conf_key , None , default .split ("," )),
@@ -63,40 +65,46 @@ def _test_as_list(env_key, conf_key, default):
6365 * _test_as_bool ("DD_INTEGRATION_TEST" , "is_in_tests" , default = False ),
6466 * _test_as_bool ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , default = True ),
6567 * _test_as_bool ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , default = False ),
66- * _test_as_bool ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , default = False ),
68+ * _test_as_bool (
69+ "DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , default = False
70+ ),
6771 * _test_as_bool ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , default = False ),
6872 * _test_as_bool ("DD_PROFILING_ENABLED" , "profiling_enabled" , default = False ),
6973 * _test_as_bool ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , default = False ),
70- * _test_as_bool ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , default = False ),
71- * _test_as_bool ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , default = False ),
74+ * _test_as_bool (
75+ "DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , default = False
76+ ),
77+ * _test_as_bool (
78+ "DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , default = False
79+ ),
7280 * _test_as_bool ("DD_LOCAL_TEST" , "local_test" , default = False ),
73-
74- * _test_int ("DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , default = 10 ),
75- * _test_int ("DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , default = 3 ),
76-
77- * _test_as_list ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , default = "ddtrace.internal.compat,ddtrace.filters" ),
78-
81+ * _test_int (
82+ "DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , default = 10
83+ ),
84+ * _test_int (
85+ "DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , default = 3
86+ ),
87+ * _test_as_list (
88+ "DD_COLD_START_TRACE_SKIP_LIB" ,
89+ "cold_start_trace_skip_lib" ,
90+ default = "ddtrace.internal.compat,ddtrace.filters" ,
91+ ),
7992 ("DD_SERVICE" , "service" , None , None ),
8093 ("DD_SERVICE" , "service" , "" , "" ),
8194 ("DD_SERVICE" , "service" , "my_service" , "my_service" ),
82-
8395 ("AWS_LAMBDA_FUNCTION_NAME" , "function_name" , None , "function" ),
8496 ("AWS_LAMBDA_FUNCTION_NAME" , "function_name" , "" , "" ),
8597 ("AWS_LAMBDA_FUNCTION_NAME" , "function_name" , "my_function" , "my_function" ),
86-
8798 ("AWS_REGION" , "is_gov_region" , None , False ),
8899 ("AWS_REGION" , "is_gov_region" , "" , False ),
89100 ("AWS_REGION" , "is_gov_region" , "us-gov-1" , True ),
90101 ("AWS_REGION" , "is_gov_region" , "us-est-1" , False ),
91-
92102 ("AWS_LAMBDA_FUNCTION_NAME" , "is_lambda_context" , None , False ),
93103 ("AWS_LAMBDA_FUNCTION_NAME" , "is_lambda_context" , "" , False ),
94104 ("AWS_LAMBDA_FUNCTION_NAME" , "is_lambda_context" , "my_function" , True ),
95-
96105 ("DD_TRACE_EXTRACTOR" , "trace_extractor" , None , None ),
97106 ("DD_TRACE_EXTRACTOR" , "trace_extractor" , "" , "" ),
98107 ("DD_TRACE_EXTRACTOR" , "trace_extractor" , "my_extractor" , "my_extractor" ),
99-
100108 ("DD_ENV" , "env" , None , None ),
101109 ("DD_ENV" , "env" , "" , "" ),
102110 ("DD_ENV" , "env" , "my_env" , "my_env" ),
@@ -113,9 +121,14 @@ def test_config_from_environ(env_key, conf_key, env_val, conf_val, setenv):
113121 * _test_as_bool ("DD_TRACE_MANAGED_SERVICES" , "make_inferred_span" , default = True ),
114122)
115123
116- @pytest .mark .parametrize ('env_key,conf_key,env_val,conf_val' , _test_config_from_environ_depends_on_tracing )
117- @pytest .mark .parametrize ('trace_enabled' , [True , False ])
118- def test_config_from_environ_depends_on_tracing (env_key , conf_key , env_val , conf_val , setenv , trace_enabled ):
124+
125+ @pytest .mark .parametrize (
126+ "env_key,conf_key,env_val,conf_val" , _test_config_from_environ_depends_on_tracing
127+ )
128+ @pytest .mark .parametrize ("trace_enabled" , [True , False ])
129+ def test_config_from_environ_depends_on_tracing (
130+ env_key , conf_key , env_val , conf_val , setenv , trace_enabled
131+ ):
119132 setenv (env_key , env_val )
120133 setenv ("DD_TRACE_ENABLED" , "true" if trace_enabled else "false" )
121134 if trace_enabled :
0 commit comments