[pypy-svn] r76266 - in pypy/branch/unicode_filename-2/pypy: module/_file/test module/posix/test rlib/test

afa at codespeak.net afa at codespeak.net
Fri Jul 16 22:39:41 CEST 2010


Author: afa
Date: Fri Jul 16 22:39:39 2010
New Revision: 76266

Modified:
   pypy/branch/unicode_filename-2/pypy/module/_file/test/test_file.py
   pypy/branch/unicode_filename-2/pypy/module/posix/test/test_posix2.py
   pypy/branch/unicode_filename-2/pypy/rlib/test/test_rposix.py
Log:
on tannit32, sys.getfilesystemencoding() is 'ascii' :-(
Skip tests when the filename cannot be encoded.


Modified: pypy/branch/unicode_filename-2/pypy/module/_file/test/test_file.py
==============================================================================
--- pypy/branch/unicode_filename-2/pypy/module/_file/test/test_file.py	(original)
+++ pypy/branch/unicode_filename-2/pypy/module/_file/test/test_file.py	Fri Jul 16 22:39:39 2010
@@ -126,6 +126,11 @@
         f.close()
 
     def test_unicode_filename(self):
+        import sys
+        try:
+            u'\xe9'.encode(sys.getfilesystemencoding())
+        except UnicodeEncodeError:
+            skip("encoding not good enough")
         f = self.file(self.temppath + u'\xe9', "w")
         f.close()
 

Modified: pypy/branch/unicode_filename-2/pypy/module/posix/test/test_posix2.py
==============================================================================
--- pypy/branch/unicode_filename-2/pypy/module/posix/test/test_posix2.py	(original)
+++ pypy/branch/unicode_filename-2/pypy/module/posix/test/test_posix2.py	Fri Jul 16 22:39:39 2010
@@ -713,7 +713,10 @@
     def setup_class(cls):
         ufilename = (unicode(udir.join('test_unicode_filename_')) +
                      u'\u65e5\u672c.txt') # "Japan"
-        f = file(ufilename, 'w')
+        try:
+            f = file(ufilename, 'w')
+        except UnicodeEncodeError:
+            py.test.skip("encoding not good enough")
         f.write("test")
         f.close()
         cls.space = space

Modified: pypy/branch/unicode_filename-2/pypy/rlib/test/test_rposix.py
==============================================================================
--- pypy/branch/unicode_filename-2/pypy/rlib/test/test_rposix.py	(original)
+++ pypy/branch/unicode_filename-2/pypy/rlib/test/test_rposix.py	Fri Jul 16 22:39:39 2010
@@ -2,6 +2,7 @@
 from pypy.tool.udir import udir
 from pypy.rlib import rposix
 import os, sys
+import py
 
 def ll_to_string(s):
     return ''.join(s.chars)
@@ -28,7 +29,10 @@
     def setup_method(self, method):
         self.ufilename = (unicode(udir.join('test_open')) +
                           u'\u65e5\u672c.txt') # "Japan"
-        f = file(self.ufilename, 'w')
+        try:
+            f = file(self.ufilename, 'w')
+        except UnicodeEncodeError:
+            py.test.skip("encoding not good enough")
         f.write("test")
         f.close()
 



More information about the Pypy-commit mailing list