Skip to content

Commit 7b3c182

Browse files
[mq] [skip ddci] working branch - merge 6c79212 on top of main at 9ba47b1
{"baseBranch":"main","baseCommit":"9ba47b1f0c88e7ba74cb8720ea18ffa681d65e02","createdAt":"2026-08-14T13:54:02.764085Z","headSha":"6c79212b6023b20235a7bbda1a4bf3a80e4189a9","id":"c36e9ee8-0c54-4218-8832-85a106fe2aa0","priority":"200","pullRequestNumber":"19702","queuedAt":"2026-08-14T13:54:02.762400Z","status":"STATUS_QUEUED"}
2 parents fcc1160 + 6c79212 commit 7b3c182

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

tests/appsec/iast/test_product_inspect_regression.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import sys
1919

20-
from tests.utils import override_env
20+
from tests.utils import override_global_config
2121

2222

2323
def 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

0 commit comments

Comments
 (0)