Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r63353:89c6b8b4121b
Date: 2013-04-14 16:10 -0700
http://bitbucket.org/pypy/pypy/changeset/89c6b8b4121b/
Log: explicitly flush stderr (it's potentially buffered), fix import
diff --git a/pypy/module/cpyext/test/test_pyerrors.py
b/pypy/module/cpyext/test/test_pyerrors.py
--- a/pypy/module/cpyext/test/test_pyerrors.py
+++ b/pypy/module/cpyext/test/test_pyerrors.py
@@ -69,6 +69,7 @@
def test_Warning(self, space, api, capfd):
message = rffi.str2charp("this is a warning")
api.PyErr_WarnEx(None, message, 1)
+ space.call_method(space.sys.get('stderr'), "flush")
out, err = capfd.readouterr()
assert ": UserWarning: this is a warning" in err
rffi.free_charp(message)
@@ -76,6 +77,7 @@
def test_print_err(self, space, api, capfd):
api.PyErr_SetObject(space.w_Exception, space.wrap("cpyext is cool"))
api.PyErr_Print()
+ space.call_method(space.sys.get('stderr'), "flush")
out, err = capfd.readouterr()
assert "cpyext is cool" in err
assert not api.PyErr_Occurred()
@@ -84,6 +86,7 @@
api.PyErr_SetObject(space.w_ValueError, space.wrap("message"))
w_where = space.wrap("location")
api.PyErr_WriteUnraisable(w_where)
+ space.call_method(space.sys.get('stderr'), "flush")
out, err = capfd.readouterr()
assert "Exception ValueError: 'message' in 'location' ignored" ==
err.strip()
@@ -219,8 +222,8 @@
Py_RETURN_NONE;
'''),
])
- import sys, StringIO
- sys.stderr = StringIO.StringIO()
+ import io, sys
+ sys.stderr = io.StringIO()
try:
1 / 0
except ZeroDivisionError:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit