diff --git a/IPython/core/tests/test_ultratb.py b/IPython/core/tests/test_ultratb.py index 5f5dec0..39ae171 100644 --- a/IPython/core/tests/test_ultratb.py +++ b/IPython/core/tests/test_ultratb.py @@ -229,43 +229,44 @@ except Exception: #---------------------------------------------------------------------------- # module testing (minimal) -def test_handlers(): - def spam(c, d_e): - (d, e) = d_e - x = c + d - y = c * d - foo(x, y) - - def foo(a, b, bar=1): - eggs(a, b + bar) - - def eggs(f, g, z=globals()): - h = f + g - i = f - g - return h / i - - buff = io.StringIO() - - buff.write(u'') - buff.write(u'*** Before ***') - try: - buff.write(spam(1, (2, 3))) - except: - traceback.print_exc(file=buff) - - handler = ColorTB(ostream=buff) - buff.write(u'*** ColorTB ***') - try: - buff.write(spam(1, (2, 3))) - except: - handler(*sys.exc_info()) - buff.write(u'') - - handler = VerboseTB(ostream=buff) - buff.write(u'*** VerboseTB ***') - try: - buff.write(spam(1, (2, 3))) - except: - handler(*sys.exc_info()) - buff.write(u'') +if sys.version_info > (3,): + def test_handlers(): + def spam(c, d_e): + (d, e) = d_e + x = c + d + y = c * d + foo(x, y) + + def foo(a, b, bar=1): + eggs(a, b + bar) + + def eggs(f, g, z=globals()): + h = f + g + i = f - g + return h / i + + buff = io.StringIO() + + buff.write('') + buff.write('*** Before ***') + try: + buff.write(spam(1, (2, 3))) + except: + traceback.print_exc(file=buff) + + handler = ColorTB(ostream=buff) + buff.write('*** ColorTB ***') + try: + buff.write(spam(1, (2, 3))) + except: + handler(*sys.exc_info()) + buff.write('') + + handler = VerboseTB(ostream=buff) + buff.write('*** VerboseTB ***') + try: + buff.write(spam(1, (2, 3))) + except: + handler(*sys.exc_info()) + buff.write('')