Author: Amaury Forgeot d'Arc <amaur...@gmail.com>
Branch: 
Changeset: r47943:c7c09446a462
Date: 2011-10-11 21:35 +0200
http://bitbucket.org/pypy/pypy/changeset/c7c09446a462/

Log:    Skip unicode tests when filesystem encoding is not good enough

diff --git a/pypy/module/posix/test/test_posix2.py 
b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -420,12 +420,15 @@
             import sys
             if not hasattr(os, "fork"):
                 skip("Need fork() to test execv()")
+            try:
+                output = u"caf\xe9 
\u1234\n".encode(sys.getfilesystemencoding())
+            except UnicodeEncodeError:
+                skip("encoding not good enough")
             pid = os.fork()
             if pid == 0:
                 os.execv(u"/bin/sh", ["sh", "-c",
                                       u"echo caf\xe9 \u1234 > onefile"])
             os.waitpid(pid, 0)
-            output = u"caf\xe9 \u1234\n".encode(sys.getfilesystemencoding())
             assert open("onefile").read() == output
             os.unlink("onefile")
 
@@ -445,13 +448,16 @@
             import sys
             if not hasattr(os, "fork"):
                 skip("Need fork() to test execve()")
+            try:
+                output = u"caf\xe9 
\u1234\n".encode(sys.getfilesystemencoding())
+            except UnicodeEncodeError:
+                skip("encoding not good enough")
             pid = os.fork()
             if pid == 0:
                 os.execve(u"/bin/sh", ["sh", "-c",
                                       u"echo caf\xe9 \u1234 > onefile"],
                           {'ddd': 'xxx'})
             os.waitpid(pid, 0)
-            output = u"caf\xe9 \u1234\n".encode(sys.getfilesystemencoding())
             assert open("onefile").read() == output
             os.unlink("onefile")
         pass # <- please, inspect.getsource(), don't crash
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to