[pypy-commit] pypy py3.5: fix/skip easy tests (test_codecs checked on cpython3)
mattip
pypy.commits at gmail.com
Mon Jan 8 16:20:22 EST 2018
Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.5
Changeset: r93641:f5c9251c71a6
Date: 2018-01-08 23:19 +0200
http://bitbucket.org/pypy/pypy/changeset/f5c9251c71a6/
Log: fix/skip easy tests (test_codecs checked on cpython3)
diff --git a/pypy/module/_codecs/test/test_codecs.py b/pypy/module/_codecs/test/test_codecs.py
--- a/pypy/module/_codecs/test/test_codecs.py
+++ b/pypy/module/_codecs/test/test_codecs.py
@@ -892,7 +892,7 @@
assert False, 'cannot test mbcs on this windows system, check code page'
assert u'test'.encode('mbcs') == b'test'
assert toencode[0].encode('mbcs') == toencode[1]
- assert u'\u040a'.encode('mbcs') == b'?' # some cyrillic letter
+ raises(UnicodeEncodeError, u'\u040a'.encode, 'mbcs')
assert b'cafx\e9'.decode('mbcs') == u'cafx\e9'
def test_handler_string_result(self):
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
@@ -1424,6 +1424,7 @@
skip("_getfinalpathname not supported on this platform")
assert os.path.exists(result)
+ @py.test.mark.skipif("sys.platform == 'win32'")
def test_rtld_constants(self):
# check presence of major RTLD_* constants
self.posix.RTLD_LAZY
@@ -1432,6 +1433,7 @@
self.posix.RTLD_LOCAL
def test_error_message(self):
+ import sys
e = raises(OSError, self.posix.open, 'nonexistentfile1', 0)
assert str(e.value).endswith(": 'nonexistentfile1'")
@@ -1442,8 +1444,9 @@
e = raises(OSError, self.posix.replace, 'nonexistentfile1', 'bok')
assert str(e.value).endswith(": 'nonexistentfile1' -> 'bok'")
- e = raises(OSError, self.posix.symlink, 'bok', '/nonexistentdir/boz')
- assert str(e.value).endswith(": 'bok' -> '/nonexistentdir/boz'")
+ if sys.platform != 'win32':
+ e = raises(OSError, self.posix.symlink, 'bok', '/nonexistentdir/boz')
+ assert str(e.value).endswith(": 'bok' -> '/nonexistentdir/boz'")
if hasattr(rposix, 'getxattr'):
def test_xattr_simple(self):
@@ -1472,8 +1475,8 @@
cls.w_path = space.wrap(str(path))
def test_environ(self):
- import sys, posix
- environ = posix.environ
+ import sys, os
+ environ = os.environ
item_type = str if sys.platform.startswith('win') else bytes
for k, v in environ.items():
assert type(k) is item_type
@@ -1536,25 +1539,25 @@
class AppTestPosixUnicode:
def test_stat_unicode(self):
# test that passing unicode would not raise UnicodeDecodeError
- import posix
+ import os
try:
- posix.stat(u"ą")
+ os.stat(u"ą")
except OSError:
pass
def test_open_unicode(self):
# Ensure passing unicode doesn't raise UnicodeEncodeError
- import posix
+ import os
try:
- posix.open(u"ą", posix.O_WRONLY)
+ os.open(u"ą", os.O_WRONLY)
except OSError:
pass
def test_remove_unicode(self):
# See 2 above ;)
- import posix
+ import os
try:
- posix.remove(u"ą")
+ os.remove(u"ą")
except OSError:
pass
More information about the pypy-commit
mailing list