From 9f93e6d3256c585b18f8747786b25325f10a1082 Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Wed, 28 Dec 2022 04:35:03 +0000 Subject: [PATCH] copy environ --- Lib/test/test_asyncio/test_subprocess.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index 1ae290a003f212..f1ad10a9903fe8 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -698,7 +698,8 @@ async def check_stdout_output(self, coro, output): def test_create_subprocess_env_shell(self) -> None: async def main() -> None: cmd = f'''{sys.executable} -c "import os, sys; sys.stdout.write(os.getenv('FOO'))"''' - env = {"FOO": 'bar'} + env = os.environ.copy() + env["FOO"] = "bar" proc = await asyncio.create_subprocess_shell( cmd, env=env, stdout=subprocess.PIPE ) @@ -710,7 +711,8 @@ def test_create_subprocess_env_exec(self) -> None: async def main() -> None: cmd = [sys.executable, "-c", "import os, sys; sys.stdout.write(os.getenv('FOO'))"] - env = {"FOO": 'baz'} + env = os.environ.copy() + env["FOO"] = "baz" proc = await asyncio.create_subprocess_exec( *cmd, env=env, stdout=subprocess.PIPE )