[pypy-svn] r78401 - in pypy/branch/fast-forward/pypy/module/_io: . test
afa at codespeak.net
afa at codespeak.net
Thu Oct 28 15:51:56 CEST 2010
Author: afa
Date: Thu Oct 28 15:51:55 2010
New Revision: 78401
Modified:
pypy/branch/fast-forward/pypy/module/_io/interp_io.py
pypy/branch/fast-forward/pypy/module/_io/test/test_io.py
Log:
Test and fix for BlockingIOError
Modified: pypy/branch/fast-forward/pypy/module/_io/interp_io.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/interp_io.py (original)
+++ pypy/branch/fast-forward/pypy/module/_io/interp_io.py Thu Oct 28 15:51:55 2010
@@ -18,7 +18,7 @@
self.written = written
W_BlockingIOError.typedef = TypeDef(
- 'BlockingIOError',
+ 'BlockingIOError', W_IOError.typedef,
__doc__ = ("Exception raised when I/O would block "
"on a non-blocking I/O stream"),
__new__ = generic_new_descr(W_BlockingIOError),
Modified: pypy/branch/fast-forward/pypy/module/_io/test/test_io.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/test/test_io.py (original)
+++ pypy/branch/fast-forward/pypy/module/_io/test/test_io.py Thu Oct 28 15:51:55 2010
@@ -42,6 +42,16 @@
import _io
e = _io.UnsupportedOperation("seek")
+ def test_blockingerror(self):
+ import _io
+ try:
+ raise _io.BlockingIOError(42, "test blocking", 123)
+ except IOError, e:
+ assert isinstance(e, _io.BlockingIOError)
+ assert e.errno == 42
+ assert e.strerror == "test blocking"
+ assert e.characters_written == 123
+
def test_destructor(self):
import io
io.IOBase()
More information about the Pypy-commit
mailing list