From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Wed, 28 Dec 2022 05:46:04 +0000 (+0530) Subject: GH-100192: fix `asyncio` subprocess tests to pass env vars to subprocess (#100569) X-Git-Tag: v3.12.0a4~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6835184a44389747dd151023b31a20ff75d6a402;p=thirdparty%2FPython%2Fcpython.git GH-100192: fix `asyncio` subprocess tests to pass env vars to subprocess (#100569) --- diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index 1ae290a003f2..f1ad10a9903f 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -698,7 +698,8 @@ class SubprocessMixin: 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 @@ class SubprocessMixin: 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 )