Author: Brian Kearns <bdkea...@gmail.com> Branch: Changeset: r73175:dc7c03274026 Date: 2014-08-29 09:01 -0700 http://bitbucket.org/pypy/pypy/changeset/dc7c03274026/
Log: fix this test against cpython on win32 diff --git a/pypy/module/_file/test/test_file_extra.py b/pypy/module/_file/test/test_file_extra.py --- a/pypy/module/_file/test/test_file_extra.py +++ b/pypy/module/_file/test/test_file_extra.py @@ -554,14 +554,16 @@ import errno, sys f = open(fn) - exc = raises(EnvironmentError, f.truncate, 3) - if sys.platform == 'win32': - assert exc.value.errno == 5 # ERROR_ACCESS_DENIED + exc = raises(IOError, f.truncate, 3) + # CPython explicitly checks the file mode + # PyPy relies on the libc to raise the error + if '__pypy__' not in sys.builtin_module_names: + assert str(exc.value) == "File not open for writing" else: - # CPython explicitely checks the file mode - # PyPy relies on the libc to raise the error - assert (exc.value.message == "File not open for writing" or - exc.value.errno == errno.EINVAL) + if sys.platform == 'win32': + assert exc.value.errno == 5 # ERROR_ACCESS_DENIED + else: + assert exc.value.errno == errno.EINVAL f.close() def test_readinto(self): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit