Skip to content

Commit

Permalink
Fix edb tests to render running progress without artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 committed Jul 7, 2020
1 parent 5645831 commit 3ed155e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions edb/tools/test/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ def __init__(self, *, tests, stream):
self.buffer = collections.defaultdict(str)
self.last_lines = -1
self.max_lines = 0
self.max_label_lines_rendered = collections.defaultdict(int)

def report(self, test, marker, description=None, *, currently_running):
if marker in {Markers.failed, Markers.errored}:
Expand Down Expand Up @@ -488,6 +489,16 @@ def _render_test_list(label, max_lines, tests, style):
line = self._color_second_column(line, style)
lines.append(line)

# Prevent the rendered output from "jumping" up/down when we
# render 2 lines worth of running tests just after we rendered
# 3 lines.
for _ in range(self.max_label_lines_rendered[label] - tests_lines):
lines.append(' ' * cols)
self.max_label_lines_rendered[label] = max(
self.max_label_lines_rendered[label],
tests_lines
)

clear_cmd = ''
if self.last_lines > 0:
# Move cursor up `last_lines` times.
Expand Down

0 comments on commit 3ed155e

Please sign in to comment.