mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Merge pull request #1817 from pared/1807
checkout: reset progress bar on checkout
This commit is contained in:
@@ -144,6 +144,7 @@ class ProgressCallback(object):
|
||||
def __init__(self, total):
|
||||
self.total = total
|
||||
self.current = 0
|
||||
progress.reset()
|
||||
|
||||
def update(self, name, progress_to_add=1):
|
||||
self.current += progress_to_add
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import mock
|
||||
from unittest import TestCase
|
||||
|
||||
from dvc.progress import progress, progress_aware
|
||||
from dvc.progress import progress, progress_aware, ProgressCallback
|
||||
|
||||
|
||||
class TestProgressAware(TestCase):
|
||||
@@ -25,3 +25,13 @@ class TestProgressAware(TestCase):
|
||||
self.assertEqual(4, mock_print.call_count)
|
||||
|
||||
progress.finish_target("testing")
|
||||
|
||||
|
||||
class TestProgressCallback(TestCase):
|
||||
@mock.patch("dvc.progress.progress")
|
||||
def test_should_init_reset_progress(self, progress_mock):
|
||||
total_files_num = 1
|
||||
|
||||
ProgressCallback(total_files_num)
|
||||
|
||||
self.assertEqual([mock.call.reset()], progress_mock.method_calls)
|
||||
|
||||
Reference in New Issue
Block a user