Skip to content

Commit

Permalink
GH-100192: fix asyncio subprocess tests to pass env vars to subproc…
Browse files Browse the repository at this point in the history
…ess (#100569)
  • Loading branch information
kumaraditya303 authored Dec 28, 2022
1 parent b95b1b3 commit 6835184
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Lib/test/test_asyncio/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
)
Expand Down

0 comments on commit 6835184

Please sign in to comment.