]> granicus.if.org Git - python/commitdiff
test_subprocess: test_undecodable_env() is specific to POSIX system
authorVictor Stinner <victor.stinner@haypocalc.com>
Tue, 27 Apr 2010 18:29:45 +0000 (18:29 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Tue, 27 Apr 2010 18:29:45 +0000 (18:29 +0000)
The bug was introduced by the backport of r80421 (r80494).

Lib/test/test_subprocess.py

index 7711293a3248e89dd45ce639f6080fa40e781fe0..a4a44072dde51b8d552fc39a021c62453512434e 100644 (file)
@@ -539,32 +539,6 @@ class ProcessTestCase(unittest.TestCase):
                 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 @@ class ProcessTestCase(unittest.TestCase):
             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
     #