]> granicus.if.org Git - python/commitdiff
Issue #7605: Fix test_cmd_line if the current working directory is not ASCII
authorVictor Stinner <victor.stinner@haypocalc.com>
Fri, 16 Apr 2010 15:10:27 +0000 (15:10 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Fri, 16 Apr 2010 15:10:27 +0000 (15:10 +0000)
Lib/test/test_cmd_line.py

index d68a5dbe19a1da3343a890ab0eff63a1a0e98246..6688998153789a7ae1ecec01efc7db019ceed00a 100644 (file)
@@ -162,8 +162,15 @@ class CmdLineTest(unittest.TestCase):
             path1 = "ABCDE" * 100
             path2 = "FGHIJ" * 100
             env['PYTHONPATH'] = path1 + os.pathsep + path2
-            p = _spawn_python_with_env('-S', '-c',
-                                       'import sys; print(sys.path)')
+
+            code = """
+import sys
+path = ":".join(sys.path)
+path = path.encode("ascii", "backslashreplace")
+sys.stdout.buffer.write(path)"""
+            code = code.strip().splitlines()
+            code = '; '.join(code)
+            p = _spawn_python_with_env('-S', '-c', code)
             stdout, _ = p.communicate()
             self.assertIn(path1.encode('ascii'), stdout)
             self.assertIn(path2.encode('ascii'), stdout)