mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
pull/fetch/push: add stats (#3735)
* pull/fetch/push: add stats * fix typo: s/logging/logger * pull: make stats detailed, with summary at the bottom * tests: mock properly, set return_value * add a line space
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
|
||||
from dvc.cli import parse_args
|
||||
from dvc.command.checkout import CmdCheckout, log_summary, log_changes
|
||||
from dvc.command.checkout import CmdCheckout, log_changes
|
||||
|
||||
|
||||
def test_checkout(tmp_dir, dvc, mocker):
|
||||
@@ -23,33 +23,6 @@ def test_checkout(tmp_dir, dvc, mocker):
|
||||
)
|
||||
|
||||
|
||||
def test_log_summary(caplog):
|
||||
stats = {
|
||||
"added": ["file1", "file2", "file3"],
|
||||
"deleted": ["file4", "file5"],
|
||||
"modified": ["file6", "file7"],
|
||||
}
|
||||
|
||||
def _assert_output(stats, expected_text):
|
||||
with caplog.at_level(logging.INFO, logger="dvc"):
|
||||
caplog.clear()
|
||||
log_summary(stats)
|
||||
assert expected_text in caplog.text
|
||||
|
||||
_assert_output(stats, "3 added, 2 deleted and 2 modified")
|
||||
|
||||
del stats["deleted"][1]
|
||||
_assert_output(stats, "3 added, 1 deleted and 2 modified")
|
||||
|
||||
del stats["deleted"][0]
|
||||
_assert_output(stats, "3 added and 2 modified")
|
||||
|
||||
del stats["modified"]
|
||||
_assert_output(stats, "3 added")
|
||||
|
||||
_assert_output({}, "No changes.")
|
||||
|
||||
|
||||
def test_log_changes(caplog):
|
||||
stats = {
|
||||
"added": ["file1", "dir1/"],
|
||||
|
||||
Reference in New Issue
Block a user