[Checkins] SVN: zope.testing/branches/regebro-python3/src/zope/testing/testrunner/formatter.py py3: if stdout is wrapped, it throws an UnsupportedOperation: fileno()
Wolfgang Schnerring
wosc at wosc.de
Sun Sep 13 04:30:30 EDT 2009
Log message for revision 103883:
py3: if stdout is wrapped, it throws an UnsupportedOperation: fileno()
Changed:
U zope.testing/branches/regebro-python3/src/zope/testing/testrunner/formatter.py
-=-
Modified: zope.testing/branches/regebro-python3/src/zope/testing/testrunner/formatter.py
===================================================================
--- zope.testing/branches/regebro-python3/src/zope/testing/testrunner/formatter.py 2009-09-13 08:29:32 UTC (rev 103882)
+++ zope.testing/branches/regebro-python3/src/zope/testing/testrunner/formatter.py 2009-09-13 08:30:29 UTC (rev 103883)
@@ -374,9 +374,14 @@
# avoid reimporting a broken module in python 2.3
sys.modules['curses'] = None
else:
+ ignored_exceptions = [curses.error, TypeError]
+ if sys.version_info >= (3,):
+ import io
+ ignored_exceptions.append(io.UnsupportedOperation)
+ ignored_exceptions = tuple(ignored_exceptions)
try:
curses.setupterm()
- except (curses.error, TypeError):
+ except ignored_exceptions:
# You get curses.error when $TERM is set to an unknown name
# You get TypeError when sys.stdout is not a real file object
# (e.g. in unit tests that use various wrappers).
More information about the checkins
mailing list