[Python-checkins] r80539 - python/branches/release31-maint/Lib/test/test_subprocess.py

victor.stinner python-checkins at python.org
Tue Apr 27 20:29:45 CEST 2010


Author: victor.stinner
Date: Tue Apr 27 20:29:45 2010
New Revision: 80539

Log:
test_subprocess: test_undecodable_env() is specific to POSIX system

The bug was introduced by the backport of r80421 (r80494).


Modified:
   python/branches/release31-maint/Lib/test/test_subprocess.py

Modified: python/branches/release31-maint/Lib/test/test_subprocess.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_subprocess.py	(original)
+++ python/branches/release31-maint/Lib/test/test_subprocess.py	Tue Apr 27 20:29:45 2010
@@ -539,32 +539,6 @@
                 if err.errno != 2:  # ignore "no such file"
                     raise
 
-    def test_undecodable_env(self):
-        for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')):
-            value_repr = repr(value).encode("ascii")
-
-            # test str with surrogates
-            script = "import os; print(repr(os.getenv(%s)))" % repr(key)
-            env = os.environ.copy()
-            env[key] = value
-            stdout = subprocess.check_output(
-                [sys.executable, "-c", script],
-                env=env)
-            stdout = stdout.rstrip(b'\n\r')
-            self.assertEquals(stdout, value_repr)
-
-            # test bytes
-            key = key.encode("ascii", "surrogateescape")
-            value = value.encode("ascii", "surrogateescape")
-            script = "import os; print(repr(os.getenv(%s)))" % repr(key)
-            env = os.environ.copy()
-            env[key] = value
-            stdout = subprocess.check_output(
-                [sys.executable, "-c", script],
-                env=env)
-            stdout = stdout.rstrip(b'\n\r')
-            self.assertEquals(stdout, value_repr)
-
     #
     # POSIX tests
     #
@@ -704,6 +678,32 @@
             p.terminate()
             self.assertEqual(p.wait(), -signal.SIGTERM)
 
+        def test_undecodable_env(self):
+            for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')):
+                value_repr = repr(value).encode("ascii")
+
+                # test str with surrogates
+                script = "import os; print(repr(os.getenv(%s)))" % repr(key)
+                env = os.environ.copy()
+                env[key] = value
+                stdout = subprocess.check_output(
+                    [sys.executable, "-c", script],
+                    env=env)
+                stdout = stdout.rstrip(b'\n\r')
+                self.assertEquals(stdout, value_repr)
+
+                # test bytes
+                key = key.encode("ascii", "surrogateescape")
+                value = value.encode("ascii", "surrogateescape")
+                script = "import os; print(repr(os.getenv(%s)))" % repr(key)
+                env = os.environ.copy()
+                env[key] = value
+                stdout = subprocess.check_output(
+                    [sys.executable, "-c", script],
+                    env=env)
+                stdout = stdout.rstrip(b'\n\r')
+                self.assertEquals(stdout, value_repr)
+
     #
     # Windows tests
     #


More information about the Python-checkins mailing list