Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests on windows
  • Loading branch information
kumaraditya303 committed Dec 12, 2022
commit 1d96bf75e78d83e995516bd4871691686328968e
8 changes: 4 additions & 4 deletions Lib/test/test_asyncio/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,13 @@ async def execute():

def test_create_subprocess_env_shell(self) -> None:
async def main() -> None:
cmd = f'''{sys.executable} -c "import os; print(os.getenv('FOO'))"'''
cmd = f'''{sys.executable} -c "import os, sys; sys.stdout.write(os.getenv('FOO'))"'''
env = {"FOO": 'bar'}
proc = await asyncio.create_subprocess_shell(
cmd, env=env, stdout=subprocess.PIPE
)
stdout, _ = await proc.communicate()
self.assertEqual(stdout, b"bar\n")
self.assertEqual(stdout, b"bar")
self.assertEqual(proc.returncode, 0)
task = asyncio.create_task(proc.wait())
await asyncio.sleep(0)
Expand All @@ -705,13 +705,13 @@ async def main() -> None:
def test_create_subprocess_env_exec(self) -> None:
async def main() -> None:
cmd = [sys.executable, "-c",
"import os; print(os.getenv('FOO'))"]
"import os, sys; sys.stdout.write(os.getenv('FOO'))"]
env = {"FOO": 'bar'}
proc = await asyncio.create_subprocess_exec(
*cmd, env=env, stdout=subprocess.PIPE
)
stdout, _ = await proc.communicate()
self.assertEqual(stdout, b"bar\n")
self.assertEqual(stdout, b"bar")
self.assertEqual(proc.returncode, 0)
task = asyncio.create_task(proc.wait())
await asyncio.sleep(0)
Expand Down