Skip to content

Commit 72b3bbc

Browse files
make sure env vars are updated as expected for load_module test
1 parent 6cad0b7 commit 72b3bbc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/appsec/integrations/flask_tests/test_appsec_loading_modules.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,25 @@
2424
@pytest.mark.parametrize("aws_lambda", ["any", None])
2525
def test_loading(appsec_enabled, iast_enabled, aws_lambda):
2626
flask_app = pathlib.Path(__file__).parent / "mini.py"
27-
env = {}
27+
env = os.environ.copy()
2828
if appsec_enabled:
2929
env["DD_APPSEC_ENABLED"] = appsec_enabled
30+
else:
31+
env.pop("DD_APPSEC_ENABLED", None)
3032
if iast_enabled:
3133
env["DD_IAST_ENABLED"] = iast_enabled
34+
else:
35+
env.pop("DD_IAST_ENABLED", None)
3236
if aws_lambda:
3337
env["AWS_LAMBDA_FUNCTION_NAME"] = aws_lambda
34-
35-
all_env = os.environ | env
38+
else:
39+
env.pop("AWS_LAMBDA_FUNCTION_NAME", None)
3640

3741
process = subprocess.Popen(
3842
["python", str(flask_app)],
3943
stdout=subprocess.PIPE,
4044
stderr=subprocess.PIPE,
41-
env=all_env,
45+
env=env,
4246
)
4347
for i in range(16):
4448
time.sleep(1)

0 commit comments

Comments
 (0)