Merge pull request #1817 from pared/1807

checkout: reset progress bar on checkout
This commit is contained in:
Ruslan Kuprieiev
2019-03-31 22:56:49 +03:00
committed by GitHub
2 changed files with 12 additions and 1 deletions
+1
View File
@@ -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
+11 -1
View File
@@ -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)