Skip to content

Commit 62c0746

Browse files
ylnJulian Lettner
authored andcommitted
[lit] Rename ProgressDisplay -> Display
1 parent 2f856a3 commit 62c0746

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

llvm/utils/lit/lit/display.py

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import sys
22

3-
import lit.ProgressBar
43

54
def create_display(opts, tests, total_tests, workers):
65
if opts.quiet:
7-
return NopProgressDisplay()
6+
return NopDisplay()
87

98
of_total = (' of %d' % total_tests) if (tests != total_tests) else ''
109
header = '-- Testing: %d%s tests, %d workers --' % (tests, of_total, workers)
1110

1211
progress_bar = None
1312
if opts.succinct and opts.useProgressBar:
13+
import lit.ProgressBar
1414
try:
1515
tc = lit.ProgressBar.TerminalController()
1616
progress_bar = lit.ProgressBar.ProgressBar(tc, header)
@@ -23,25 +23,21 @@ def create_display(opts, tests, total_tests, workers):
2323
if progress_bar:
2424
progress_bar.update(0, '')
2525

26-
return ProgressDisplay(opts, tests, progress_bar)
26+
return Display(opts, tests, progress_bar)
2727

28-
class NopProgressDisplay(object):
28+
29+
class NopDisplay(object):
2930
def update(self, test): pass
3031
def finish(self): pass
3132

32-
class ProgressDisplay(object):
33-
def __init__(self, opts, numTests, progressBar):
33+
34+
class Display(object):
35+
def __init__(self, opts, tests, progress_bar):
3436
self.opts = opts
35-
self.numTests = numTests
36-
self.progressBar = progressBar
37+
self.tests = tests
38+
self.progress_bar = progress_bar
3739
self.completed = 0
3840

39-
def finish(self):
40-
if self.progressBar:
41-
self.progressBar.clear()
42-
elif self.opts.succinct:
43-
sys.stdout.write('\n')
44-
4541
def update(self, test):
4642
self.completed += 1
4743

@@ -51,20 +47,26 @@ def update(self, test):
5147
if show_result:
5248
self.print_result(test)
5349

54-
if self.progressBar:
50+
if self.progress_bar:
5551
if test.isFailure():
56-
self.progressBar.barColor = 'RED'
57-
percent = float(self.completed) / self.numTests
58-
self.progressBar.update(percent, test.getFullName())
52+
self.progress_bar.barColor = 'RED'
53+
percent = float(self.completed) / self.tests
54+
self.progress_bar.update(percent, test.getFullName())
55+
56+
def finish(self):
57+
if self.progress_bar:
58+
self.progress_bar.clear()
59+
elif self.opts.succinct:
60+
sys.stdout.write('\n')
5961

6062
def print_result(self, test):
61-
if self.progressBar:
62-
self.progressBar.clear()
63+
if self.progress_bar:
64+
self.progress_bar.clear()
6365

6466
# Show the test result line.
6567
test_name = test.getFullName()
6668
print('%s: %s (%d of %d)' % (test.result.code.name, test_name,
67-
self.completed, self.numTests))
69+
self.completed, self.tests))
6870

6971
# Show the test failure output, if requested.
7072
if (test.isFailure() and self.opts.showOutput) or \

0 commit comments

Comments
 (0)