From 97fdc9a7fef504fc90756a00c1316f02a8ce0bc9 Mon Sep 17 00:00:00 2001 From: Alex Hartoto Date: Thu, 13 Jul 2017 12:01:21 -0700 Subject: [PATCH] Ensure final collected line doesn't include artifacts We sometimes would see the following line: collected 1 item s just because previous write to the terminal includes number of characters greater than 'collected 1 item'. --- _pytest/terminal.py | 3 +++ changelog/2571.trivial | 1 + 2 files changed, 4 insertions(+) create mode 100644 changelog/2571.trivial diff --git a/_pytest/terminal.py b/_pytest/terminal.py index af89d0fc2..0bf861ebe 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -290,6 +290,9 @@ class TerminalReporter: if self.isatty: if final: line += " \n" + # Rewrite with empty line so we will not see the artifact of + # previous write + self.rewrite('') self.rewrite(line, bold=True) else: self.write_line(line) diff --git a/changelog/2571.trivial b/changelog/2571.trivial new file mode 100644 index 000000000..45750f122 --- /dev/null +++ b/changelog/2571.trivial @@ -0,0 +1 @@ +Ensure final collected line doesn't include artifacts of previous write.