diff --git a/IPython/core/page.py b/IPython/core/page.py index 31f351a..4a6af2f 100644 --- a/IPython/core/page.py +++ b/IPython/core/page.py @@ -69,6 +69,11 @@ def page_dumb(strng, start=0, screen_lines=25): print >>io.stdout, last_escape + os.linesep.join(screens[-1]) def _detect_screen_size(use_curses, screen_lines_def): + """Attempt to work out the number of lines on the screen. + + This is called by page(). It can raise an error (e.g. when run in the + test suite), so it's separated out so it can easily be called in a try block. + """ if (TERM=='xterm' or TERM=='xterm-color') and sys.platform != 'sunos5': local_use_curses = use_curses else: diff --git a/IPython/testing/tools.py b/IPython/testing/tools.py index 36986ff..053ffba 100644 --- a/IPython/testing/tools.py +++ b/IPython/testing/tools.py @@ -325,6 +325,7 @@ def check_pairs(func, pairs): out = func(inp) assert out == expected, pair_fail_msg.format(name, inp, expected, out) + if py3compat.PY3: MyStringIO = StringIO else: @@ -337,6 +338,7 @@ else: notprinted_msg = """Did not find {0!r} in printed output (on {1}): {2!r}""" + class AssertPrints(object): """Context manager for testing that code prints certain text.