[pypy-svn] r73875 - pypy/trunk/pypy/module/posix/test
benjamin at codespeak.net
benjamin at codespeak.net
Sun Apr 18 19:50:25 CEST 2010
Author: benjamin
Date: Sun Apr 18 19:50:24 2010
New Revision: 73875
Modified:
pypy/trunk/pypy/module/posix/test/test_posix2.py
Log:
handle systems with a crummy filessytem encoding by default
Modified: pypy/trunk/pypy/module/posix/test/test_posix2.py
==============================================================================
--- pypy/trunk/pypy/module/posix/test/test_posix2.py (original)
+++ pypy/trunk/pypy/module/posix/test/test_posix2.py Sun Apr 18 19:50:24 2010
@@ -38,10 +38,12 @@
if os.name == 'nt':
py.test.skip("no sparse files on Windows")
+GET_POSIX = "(): import %s as m ; return m" % os.name
+
class AppTestPosix:
def setup_class(cls):
cls.space = space
- cls.w_posix = space.appexec([], "(): import %s as m ; return m" % os.name)
+ cls.w_posix = space.appexec([], GET_POSIX)
cls.w_path = space.wrap(str(path))
cls.w_path2 = space.wrap(str(path2))
cls.w_pdir = space.wrap(str(pdir))
@@ -143,13 +145,6 @@
st = self.posix.lstat(".")
assert stat.S_ISDIR(st.st_mode)
- def test_stat_unicode(self):
- # test that passing unicode would not raise UnicodeDecodeError
- try:
- self.posix.stat(u"ą")
- except OSError:
- pass
-
def test_stat_exception(self):
import sys, errno
for fn in [self.posix.stat, self.posix.lstat]:
@@ -647,6 +642,25 @@
assert isinstance(f, file)
assert f.read() == 'xxx'
+class AppTestPosixUnicode:
+
+ def setup_class(cls):
+ cls.space = space
+ cls.w_posix = space.appexec([], GET_POSIX)
+ cls.save_fs_encoding = space.sys.filesystemencoding
+ space.sys.filesystemencoding = "utf-8"
+
+ def teardown_class(cls):
+ cls.space.sys.filesystemencoding = cls.save_fs_encoding
+
+ def test_stat_unicode(self):
+ # test that passing unicode would not raise UnicodeDecodeError
+ try:
+ self.posix.stat(u"ą")
+ except OSError:
+ pass
+
+
class TestPexpect(object):
# XXX replace with AppExpectTest class as soon as possible
def setup_class(cls):
More information about the Pypy-commit
mailing list