mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
progress: Fix showing correct final total
Reproducer: Reproducer: ./virt-install --connect test:///default \ --location tests/data/fakemedia/fake-f26-netinst.iso Before: Starting install... Retrieving 'vmlinuz' | 0 B 00:00:00 ... Retrieving 'initrd.img' | 0 B 00:00:00 ... After: Starting install... Retrieving 'vmlinuz' | 9 B 00:00:00 ... Retrieving 'initrd.img' | 9 B 00:00:00 ... progress.end() currently only reports the total amount of bytes that were last written to the UI. It should report the total amount that's been passed to update(). Reported-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
b5d6dfaa0d
commit
4114fa1aa8
@ -9,4 +9,4 @@ Meter text test 20% [=== ] 413 B/s | 2.0 kB 00:19 ETA
|
||||
|
||||
Meter text test 40% [======- ] 731 B/s | 3.9 kB 00:08 ETA
|
||||
|
||||
Meter text test | 3.9 kB 00:04 ...
|
||||
Meter text test | 4.4 kB 00:04 ...
|
||||
|
@ -9,4 +9,4 @@ Meter text test 20% [=======
|
||||
|
||||
Meter text test 40% [============== ] 731 B/s | 3.9 kB 00:00:08 ETA
|
||||
|
||||
Meter text test | 3.9 kB 00:00:04 ...
|
||||
Meter text test | 4.4 kB 00:00:04 ...
|
||||
|
@ -4,4 +4,4 @@ Meter text test 67 B/s | 200 B 00:02
|
||||
Meter text test 413 B/s | 2.0 kB 00:03
|
||||
Meter text test 731 B/s | 3.9 kB 00:04
|
||||
|
||||
Meter text test | 3.9 kB 00:04
|
||||
Meter text test | 4.4 kB 00:04
|
||||
|
@ -9,4 +9,4 @@ Meter text test 1000% [================] 413 B/s | 2.0 kB --:-- ETA
|
||||
|
||||
Meter text test 2000% [================] 731 B/s | 3.9 kB --:-- ETA
|
||||
|
||||
Meter text test | 3.9 kB 00:04 !!!
|
||||
Meter text test | 4.4 kB 00:04 !!!
|
||||
|
@ -9,4 +9,4 @@ Meter text test 100% [================] 413 B/s | 2.0 kB --:-- ETA
|
||||
|
||||
Meter text test 100% [================] 731 B/s | 3.9 kB --:-- ETA
|
||||
|
||||
Meter text test | 3.9 kB 00:04
|
||||
Meter text test | 4.4 kB 00:04
|
||||
|
@ -178,7 +178,9 @@ def test_misc_meter():
|
||||
m.update(2000)
|
||||
with unittest.mock.patch("time.time", return_value=5.0):
|
||||
m.update(4000)
|
||||
with unittest.mock.patch("time.time", return_value=6.0):
|
||||
with unittest.mock.patch("time.time", return_value=5.1):
|
||||
m.update(4500)
|
||||
with unittest.mock.patch("time.time", return_value=5.5):
|
||||
m.end()
|
||||
|
||||
# Basic output testing
|
||||
|
@ -112,10 +112,10 @@ class BaseMeter:
|
||||
assert type(amount_read) is int
|
||||
|
||||
now = time.time()
|
||||
self.last_amount_read = amount_read
|
||||
self.re.update(amount_read, now)
|
||||
if (not self.last_update_time or
|
||||
(now >= self.last_update_time + self.update_period)):
|
||||
self.re.update(amount_read, now)
|
||||
self.last_amount_read = amount_read
|
||||
self.last_update_time = now
|
||||
self._do_update(amount_read)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user