[py-svn] r62857 - in py/trunk/py/io: . testing
afa at codespeak.net
afa at codespeak.net
Wed Mar 11 13:55:45 CET 2009
Author: afa
Date: Wed Mar 11 13:55:44 2009
New Revision: 62857
Modified:
py/trunk/py/io/terminalwriter.py
py/trunk/py/io/testing/test_terminalwriter.py
Log:
Always substract the last column from the Win32 terminal console:
otherwise the last char wraps and the \n causes an empty line.
This allows more tests to pass.
Modified: py/trunk/py/io/terminalwriter.py
==============================================================================
--- py/trunk/py/io/terminalwriter.py (original)
+++ py/trunk/py/io/terminalwriter.py Wed Mar 11 13:55:44 2009
@@ -63,7 +63,9 @@
info = CONSOLE_SCREEN_BUFFER_INFO()
ctypes.windll.kernel32.GetConsoleScreenBufferInfo(
handle, ctypes.byref(info))
- return info.dwSize.Y, info.dwSize.X
+ # Substract one from the width, otherwise the cursor wraps
+ # and the ending \n causes an empty line to display.
+ return info.dwSize.Y, info.dwSize.X - 1
def get_terminal_width():
try:
@@ -218,9 +220,6 @@
def sep(self, sepchar, title=None, fullwidth=None, **kw):
if fullwidth is None:
fullwidth = self.fullwidth
- # On a Windows console, writing in the last column
- # causes a line feed.
- fullwidth -= 1
# the goal is to have the line be as long as possible
# under the condition that len(line) <= fullwidth
if title is not None:
Modified: py/trunk/py/io/testing/test_terminalwriter.py
==============================================================================
--- py/trunk/py/io/testing/test_terminalwriter.py (original)
+++ py/trunk/py/io/testing/test_terminalwriter.py Wed Mar 11 13:55:44 2009
@@ -40,7 +40,6 @@
tw.sep("-", fullwidth=60)
l = self.getlines()
assert len(l) == 1
- skip_win32()
assert l[0] == "-" * 60 + "\n"
def test_sep_with_title(self):
@@ -48,7 +47,6 @@
tw.sep("-", "hello", fullwidth=60)
l = self.getlines()
assert len(l) == 1
- skip_win32()
assert l[0] == "-" * 26 + " hello " + "-" * 27 + "\n"
def test__escaped(self):
More information about the pytest-commit
mailing list