From: Benjamin Peterson Date: Sun, 10 Jan 2010 20:42:03 +0000 (+0000) Subject: fix test_popen when the path to python has spaces #7671 X-Git-Tag: v2.7a3~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e822ab01664261c7b0e88c705c4b063bdd82b005;p=thirdparty%2FPython%2Fcpython.git fix test_popen when the path to python has spaces #7671 --- diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py index cb65fdf2fcde..454ba171e4a2 100644 --- a/Lib/test/test_popen.py +++ b/Lib/test/test_popen.py @@ -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)