mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
GH-100192: fix asyncio
subprocess tests to pass env vars to subprocess (#100569)
This commit is contained in:
parent
b95b1b3b25
commit
6835184a44
1 changed files with 4 additions and 2 deletions
|
@ -698,7 +698,8 @@ class SubprocessMixin:
|
||||||
def test_create_subprocess_env_shell(self) -> None:
|
def test_create_subprocess_env_shell(self) -> None:
|
||||||
async def main() -> None:
|
async def main() -> None:
|
||||||
cmd = f'''{sys.executable} -c "import os, sys; sys.stdout.write(os.getenv('FOO'))"'''
|
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(
|
proc = await asyncio.create_subprocess_shell(
|
||||||
cmd, env=env, stdout=subprocess.PIPE
|
cmd, env=env, stdout=subprocess.PIPE
|
||||||
)
|
)
|
||||||
|
@ -710,7 +711,8 @@ class SubprocessMixin:
|
||||||
async def main() -> None:
|
async def main() -> None:
|
||||||
cmd = [sys.executable, "-c",
|
cmd = [sys.executable, "-c",
|
||||||
"import os, sys; sys.stdout.write(os.getenv('FOO'))"]
|
"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(
|
proc = await asyncio.create_subprocess_exec(
|
||||||
*cmd, env=env, stdout=subprocess.PIPE
|
*cmd, env=env, stdout=subprocess.PIPE
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue