From f05333ab75dbd0b4a519616bbcdf762c9f3d07e6 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 21 Nov 2017 22:04:30 -0200 Subject: [PATCH] Fix rewrite to not write past the edge of the screen --- _pytest/terminal.py | 2 +- testing/test_terminal.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_pytest/terminal.py b/_pytest/terminal.py index 92bf172cb..7a18b94a7 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -214,7 +214,7 @@ class TerminalReporter: """ erase = markup.pop('erase', False) if erase: - fill_count = self.writer.fullwidth - len(line) + fill_count = self.writer.fullwidth - len(line) - 1 fill = ' ' * fill_count else: fill = '' diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 1ee506688..fd68ae637 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -222,7 +222,7 @@ class TestTerminal(object): tr.writer.fullwidth = 10 tr.write('hello') tr.rewrite('hey', erase=True) - assert f.getvalue() == 'hello' + '\r' + 'hey' + (7 * ' ') + assert f.getvalue() == 'hello' + '\r' + 'hey' + (6 * ' ') class TestCollectonly(object):