[Python-checkins] python/dist/src/Lib/test test_popen.py,1.4,1.5

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Fri, 07 Mar 2003 13:10:25 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv17046/Lib/test

Modified Files:
	test_popen.py 
Log Message:
Don't quote the path to Python unless the path contains an embedded space.
Quoting the path doesn't work on Win2K (cmd.exe) regardless, this is just
a hack to let the test pass again on Win2K (so long as Python isn't
installed in a path that does contain an embedded space).  On Win2K it
looks like we'd also have to add a second pair of double quotes, around
the entire command line.


Index: test_popen.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_popen.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test_popen.py	24 Feb 2003 15:26:39 -0000	1.4
--- test_popen.py	7 Mar 2003 21:10:21 -0000	1.5
***************
*** 15,20 ****
  # 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.
  def _do_test_commandline(cmdline, expected):
!     cmd = '"%s" -c "import sys;print sys.argv" %s' % (sys.executable, cmdline)
      data = popen(cmd).read()
      got = eval(data)[1:] # strip off argv[0]
--- 15,23 ----
  # 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
  def _do_test_commandline(cmdline, expected):
!     cmd = '%s -c "import sys;print sys.argv" %s' % (python, cmdline)
      data = popen(cmd).read()
      got = eval(data)[1:] # strip off argv[0]