Author: Brian Kearns <bdkea...@gmail.com>
Branch: stdlib-2.7.8
Changeset: r73030:a8d35e0814b0
Date: 2014-08-24 13:37 -0400
http://bitbucket.org/pypy/pypy/changeset/a8d35e0814b0/

Log:    some failing file tests to fix

diff --git a/pypy/module/_file/test/test_file.py 
b/pypy/module/_file/test/test_file.py
--- a/pypy/module/_file/test/test_file.py
+++ b/pypy/module/_file/test/test_file.py
@@ -261,6 +261,17 @@
         with self.file(self.temppath, 'r') as f:
             raises(IOError, f.truncate, 100)
 
+    def test_write_full(self):
+        try:
+            f = self.file('/dev/full', 'w', 1)
+        except IOError:
+            skip("requires '/dev/full'")
+        try:
+            f.write('hello')
+            raises(IOError, f.write, '\n')
+        finally:
+            f.close()
+
 
 class AppTestNonblocking(object):
     def setup_class(cls):
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
@@ -316,6 +316,13 @@
         exc = raises(IOError, os.fdopen, fd, 'r')
         assert exc.value.errno == errno.EISDIR
 
+    def test_fdopen_keeps_fd_open_on_errors(self):
+        path = self.path
+        posix = self.posix
+        fd = posix.open(path, posix.O_RDONLY)
+        raises(OSError, posix.fdopen, fd, 'w')
+        posix.close(fd)  # fd should not be closed
+
     def test_getcwd(self):
         assert isinstance(self.posix.getcwd(), str)
         assert isinstance(self.posix.getcwdu(), unicode)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to