File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -538,6 +538,8 @@ def _needs_update(self):
538538 divisor = self .max_value / self .term_width # float division
539539 if self .value // divisor == self .previous_value // divisor :
540540 return poll_status or self .end_time
541+ else :
542+ return True
541543 except Exception :
542544 # ignore any division errors
543545 pass
Original file line number Diff line number Diff line change @@ -139,3 +139,33 @@ def test_context_wrapper(testdir):
139139 ' 80% (4 of 5) |##### | Elapsed Time: ?:00:04 ETA: ?:00:01' ,
140140 '100% (5 of 5) |#######| Elapsed Time: ?:00:05 Time: ?:00:05' ,
141141 ])
142+
143+
144+ def test_non_timed (testdir ):
145+ v = testdir .makepyfile ('''
146+ import time
147+ import timeit
148+ import freezegun
149+ import progressbar
150+
151+ widgets = [progressbar.Percentage(), progressbar.Bar()]
152+
153+ with freezegun.freeze_time() as fake_time:
154+ timeit.default_timer = time.time
155+ with progressbar.ProgressBar(widgets=widgets, term_width=60) as bar:
156+ bar._MINIMUM_UPDATE_INTERVAL = 1e-9
157+ for _ in bar(list(range(5))):
158+ fake_time.tick(1)
159+ ''' )
160+
161+ result = testdir .runpython (v )
162+ result .stderr .lines = [l for l in result .stderr .lines if l .strip ()]
163+ pprint .pprint (result .stderr .lines , width = 70 )
164+ result .stderr .fnmatch_lines ([
165+ 'N/A%| |' ,
166+ ' 20%|########## |' ,
167+ ' 40%|##################### |' ,
168+ ' 60%|################################ |' ,
169+ ' 80%|########################################### |' ,
170+ '100%|######################################################|' ,
171+ ])
You can’t perform that action at this time.
0 commit comments