1+ import importlib
2+ import sys
3+
14import pytest
25
36from datadog_lambda .config import config , _get_env , Config
@@ -14,6 +17,19 @@ def set_env(key, value):
1417 return set_env
1518
1619
20+ def test_config_import_does_not_import_ddtrace (monkeypatch ):
21+ with monkeypatch .context () as patch :
22+ for name in list (sys .modules ):
23+ if name == "ddtrace" or name .startswith ("ddtrace." ):
24+ patch .delitem (sys .modules , name , raising = False )
25+ patch .delitem (sys .modules , "datadog_lambda.config" , raising = False )
26+ importlib .import_module ("datadog_lambda.config" )
27+ assert not any (
28+ module_name == "ddtrace" or module_name .startswith ("ddtrace." )
29+ for module_name in sys .modules
30+ ), "The config module should not import ddtrace."
31+
32+
1733def _test_as_bool (env_key , conf_key , default ):
1834 return (
1935 (env_key , conf_key , None , default ),
@@ -72,9 +88,6 @@ def _test_as_list(env_key, conf_key, default):
7288 * _test_as_bool ("DD_INTEGRATION_TEST" , "integration_test" , default = False ),
7389 * _test_as_bool ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , default = True ),
7490 * _test_as_bool ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , default = False ),
75- * _test_as_bool (
76- "DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , default = False
77- ),
7891 * _test_as_bool ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , default = False ),
7992 * _test_as_bool ("DD_PROFILING_ENABLED" , "profiling_enabled" , default = False ),
8093 * _test_as_bool ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , default = False ),
@@ -86,6 +99,8 @@ def _test_as_list(env_key, conf_key, default):
8699 ),
87100 * _test_as_bool ("DD_LOCAL_TEST" , "local_test" , default = False ),
88101 * _test_as_bool ("DD_DATA_STREAMS_ENABLED" , "data_streams_enabled" , default = False ),
102+ * _test_as_bool ("DD_APPSEC_ENABLED" , "appsec_enabled" , default = False ),
103+ * _test_as_bool ("DD_APPSEC_SCA_ENABLED" , "sca_enabled" , default = False ),
89104 * _test_int (
90105 "DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , default = 10
91106 ),
@@ -143,9 +158,6 @@ def test_config_from_environ(env_key, conf_key, env_val, conf_val, setenv):
143158 "DD_DECODE_AUTHORIZER_CONTEXT" , "decode_authorizer_context" , default = True
144159 ),
145160 * _test_as_bool ("DD_DATA_STREAMS_ENABLED" , "data_streams_enabled" , default = False ),
146- * _test_as_bool (
147- "DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , default = False
148- ),
149161)
150162
151163
0 commit comments