File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717
1818import sys
1919
20- from tests .utils import override_env
20+ from tests .utils import override_global_config
2121
2222
2323def sample_function_with_many_params (
@@ -84,16 +84,9 @@ def test_iast_post_preload_does_not_drop_inspect(self):
8484 inspect_id_before = id (sys .modules .get ("inspect" ))
8585 inspect_module_before = sys .modules .get ("inspect" )
8686
87- # Call post_preload directly (this is what happens in production)
88- # We need to ensure IAST is enabled for post_preload to run its logic
89- with override_env ({"DD_IAST_ENABLED" : "true" }):
90- # Force reload of asm_config to pick up the environment variable
91- import importlib
92-
93- from ddtrace .internal .settings import asm
94-
95- importlib .reload (asm )
96-
87+ # Enabled in place: reloading the asm module would rebind its config to a new object,
88+ # leaving every module that already imported the old one reading stale settings.
89+ with override_global_config (dict (_iast_enabled = True )):
9790 from ddtrace .internal .iast import product
9891
9992 # Call post_preload - this should NOT drop inspect
You can’t perform that action at this time.
0 commit comments