summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-08-08 19:17:15 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-08-08 19:17:15 (GMT)
commita0baf55b2b898789c049cdfb02495b1d59d4c2e0 (patch)
tree9e4efb03bcffb2956d0f5e2b90f4ba0bb0b2a3a1 /Lib
parent51d19cf22798a34285eb78426eb349354fca4320 (diff)
downloadcpython-a0baf55b2b898789c049cdfb02495b1d59d4c2e0.zip
cpython-a0baf55b2b898789c049cdfb02495b1d59d4c2e0.tar.gz
cpython-a0baf55b2b898789c049cdfb02495b1d59d4c2e0.tar.bz2
revert r83831, unix test breakage
Diffstat (limited to 'Lib')
-rw-r--r--Lib/subprocess.py2
-rw-r--r--Lib/test/test_subprocess.py54
2 files changed, 5 insertions, 51 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index e3d18c1..0009bcd 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -829,7 +829,7 @@ class Popen(object):
startupinfo.dwFlags |= _subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = _subprocess.SW_HIDE
comspec = os.environ.get("COMSPEC", "cmd.exe")
- args = comspec + " /c " + '"%s"' % args
+ args = comspec + " /c " + args
if (_subprocess.GetVersion() >= 0x80000000 or
os.path.basename(comspec).lower() == "command.com"):
# Win9x, or using command.com on NT. We need to
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 3657d75..ff9945b 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -28,7 +28,7 @@ def remove_stderr_debug_decorations(stderr):
return re.sub("\[\d+ refs\]\r?\n?$", "", stderr.decode()).encode()
#return re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr)
-class BaseTestCase(unittest.TestCase):
+class ProcessTestCase(unittest.TestCase):
def setUp(self):
# Try to minimize the number of children we have so this test
# doesn't crash on some buildbots (Alphas in particular).
@@ -41,15 +41,14 @@ class BaseTestCase(unittest.TestCase):
if hasattr(support, "reap_children"):
support.reap_children()
- def mkstemp(self, *args, **kwargs):
+ def mkstemp(self):
"""wrapper for mkstemp, calling mktemp if mkstemp is not available"""
if hasattr(tempfile, "mkstemp"):
- return tempfile.mkstemp(*args, **kwargs)
+ return tempfile.mkstemp()
else:
- fname = tempfile.mktemp(*args, **kwargs)
+ fname = tempfile.mktemp()
return os.open(fname, os.O_RDWR|os.O_CREAT), fname
-class ProcessTestCase(BaseTestCase):
#
# Generic tests
#
@@ -864,7 +863,6 @@ class ProcessTestCase(BaseTestCase):
p.terminate()
self.assertNotEqual(p.wait(), 0)
-
class CommandTests(unittest.TestCase):
# The module says:
# "NB This only works (and is only relevant) for UNIX."
@@ -895,50 +893,6 @@ class CommandTests(unittest.TestCase):
unit_tests = [ProcessTestCase, CommandTests]
-if mswindows:
- class CommandsWithSpaces (BaseTestCase):
-
- def setUp(self):
- super().setUp()
- f, fname = self.mkstemp(".py", "te st")
- self.fname = fname.lower ()
- os.write(f, b"import sys;"
- b"sys.stdout.write('%d %s' % (len(sys.argv), [a.lower () for a in sys.argv]))"
- )
- os.close(f)
-
- def tearDown(self):
- os.remove(self.fname)
- super().tearDown()
-
- def with_spaces(self, *args, **kwargs):
- kwargs['stdout'] = subprocess.PIPE
- p = subprocess.Popen(*args, **kwargs)
- self.assertEqual(
- p.stdout.read ().decode("mbcs"),
- "2 [%r, 'ab cd']" % self.fname
- )
-
- def test_shell_string_with_spaces(self):
- # call() function with string argument with spaces on Windows
- self.with_spaces('"%s" "%s"' % (self.fname, "ab cd"), shell=1)
-
- def test_shell_sequence_with_spaces(self):
- # call() function with sequence argument with spaces on Windows
- self.with_spaces([self.fname, "ab cd"], shell=1)
-
- def test_noshell_string_with_spaces(self):
- # call() function with string argument with spaces on Windows
- self.with_spaces('"%s" "%s" "%s"' % (sys.executable, self.fname,
- "ab cd"))
-
- def test_noshell_sequence_with_spaces(self):
- # call() function with sequence argument with spaces on Windows
- self.with_spaces([sys.executable, self.fname, "ab cd"])
-
- unit_tests.append(CommandsWithSpaces)
-
-
if getattr(subprocess, '_has_poll', False):
class ProcessTestCaseNoPoll(ProcessTestCase):
def setUp(self):