mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-27 23:09:28 +01:00
ui: migrate checkout to ui.write (#6028)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import logging
|
||||
|
||||
from dvc.cli import parse_args
|
||||
from dvc.command.checkout import CmdCheckout, log_changes
|
||||
from tests.func.parsing.test_errors import escape_ansi
|
||||
|
||||
|
||||
def test_checkout(tmp_dir, dvc, mocker):
|
||||
@@ -23,7 +22,7 @@ def test_checkout(tmp_dir, dvc, mocker):
|
||||
)
|
||||
|
||||
|
||||
def test_log_changes(caplog):
|
||||
def test_log_changes(capsys):
|
||||
stats = {
|
||||
"added": ["file1", "dir1/"],
|
||||
"deleted": ["dir2/"],
|
||||
@@ -33,12 +32,11 @@ def test_log_changes(caplog):
|
||||
from itertools import zip_longest
|
||||
|
||||
def _assert_output(stats, expected_outs):
|
||||
with caplog.at_level(logging.INFO, logger="dvc"):
|
||||
caplog.clear()
|
||||
log_changes(stats)
|
||||
actual_output = caplog.text.splitlines()
|
||||
for out, line in zip_longest(expected_outs, actual_output):
|
||||
assert out in line
|
||||
log_changes(stats)
|
||||
out, _ = capsys.readouterr()
|
||||
actual_output = escape_ansi(out).splitlines()
|
||||
for out, line in zip_longest(expected_outs, actual_output):
|
||||
assert out in line
|
||||
|
||||
_assert_output(stats, ["M\tfile2", "A\tfile1", "A\tdir1/", "D\tdir2/"])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user