mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
fix test_popen when the path to python has spaces #7671
This commit is contained in:
parent
0e207dff31
commit
e822ab0166
1 changed files with 1 additions and 3 deletions
|
@ -14,12 +14,10 @@ import os, sys
|
|||
# This results in Python being spawned and printing the sys.argv list.
|
||||
# We can then eval() the result of this, and see what each argv was.
|
||||
python = sys.executable
|
||||
if ' ' in python:
|
||||
python = '"' + python + '"' # quote embedded space for cmdline
|
||||
|
||||
class PopenTest(unittest.TestCase):
|
||||
def _do_test_commandline(self, cmdline, expected):
|
||||
cmd = '%s -c "import sys;print sys.argv" %s' % (python, cmdline)
|
||||
cmd = '%r -c "import sys;print sys.argv" %s' % (python, cmdline)
|
||||
data = os.popen(cmd).read()
|
||||
got = eval(data)[1:] # strip off argv[0]
|
||||
self.assertEqual(got, expected)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue