mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
naive test update
This commit is contained in:
@@ -487,12 +487,12 @@ class TestCheckoutShouldHaveSelfClearingProgressBar(TestDvc):
|
|||||||
for index, arg in enumerate(self.write_args):
|
for index, arg in enumerate(self.write_args):
|
||||||
if arg == update_bar:
|
if arg == update_bar:
|
||||||
lines = 0
|
lines = 0
|
||||||
for arg in self.write_args[index + 1:]:
|
for arg in self.write_args[index + 1 :]:
|
||||||
if arg == "\n":
|
if arg == "\n":
|
||||||
lines += 1
|
lines += 1
|
||||||
elif arg == "\x1b[A":
|
elif arg == "\x1b[A":
|
||||||
lines -= 1
|
lines -= 1
|
||||||
elif arg.startswith('\r') and 'unpacked' in arg:
|
elif arg.startswith("\r") and "unpacked" in arg:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.assertEqual(0, lines)
|
self.assertEqual(0, lines)
|
||||||
@@ -512,6 +512,7 @@ class TestCheckoutShouldHaveSelfClearingProgressBar(TestDvc):
|
|||||||
def assertAnyStartsWith(self, update_bars, name):
|
def assertAnyStartsWith(self, update_bars, name):
|
||||||
self.assertTrue(any(ub for ub in update_bars if ub.startswith(name)))
|
self.assertTrue(any(ub for ub in update_bars if ub.startswith(name)))
|
||||||
|
|
||||||
|
|
||||||
class TestCheckoutTargetRecursiveShouldNotRemoveOtherUsedFiles(TestDvc):
|
class TestCheckoutTargetRecursiveShouldNotRemoveOtherUsedFiles(TestDvc):
|
||||||
def test(self):
|
def test(self):
|
||||||
ret = main(["add", self.DATA_DIR, self.FOO, self.BAR])
|
ret = main(["add", self.DATA_DIR, self.FOO, self.BAR])
|
||||||
|
|||||||
+22
-22
@@ -154,28 +154,28 @@ class TestColorFormatter:
|
|||||||
from dvc.progress import Tqdm
|
from dvc.progress import Tqdm
|
||||||
|
|
||||||
with mocker.patch("sys.stdout.isatty", return_value=True):
|
with mocker.patch("sys.stdout.isatty", return_value=True):
|
||||||
progress.set_n_total(100)
|
with Tqdm(total=100, desc="progress") as pbar:
|
||||||
progress.update_target("progress", 1, 10)
|
pbar.update()
|
||||||
|
|
||||||
# logging an invisible message should not break
|
# logging an invisible message should not break
|
||||||
# the progress bar output
|
# the progress bar output
|
||||||
with caplog.at_level(logging.INFO, logger="dvc"):
|
with caplog.at_level(logging.INFO, logger="dvc"):
|
||||||
debug_record = logging.LogRecord(
|
debug_record = logging.LogRecord(
|
||||||
name="dvc",
|
name="dvc",
|
||||||
level=logging.DEBUG,
|
level=logging.DEBUG,
|
||||||
pathname=__name__,
|
pathname=__name__,
|
||||||
lineno=1,
|
lineno=1,
|
||||||
msg="debug",
|
msg="debug",
|
||||||
args=(),
|
args=(),
|
||||||
exc_info=None,
|
exc_info=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
formatter.format(debug_record)
|
formatter.format(debug_record)
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert "\n" not in captured.out
|
assert captured.out == ""
|
||||||
|
|
||||||
# just when the message is actually visible
|
# when the message is actually visible
|
||||||
with caplog.at_level(logging.INFO, logger="dvc"):
|
with caplog.at_level(logging.INFO, logger="dvc"):
|
||||||
logger.info("some info")
|
logger.info("some info")
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert "\n" in captured.out
|
captured.out == ""
|
||||||
|
|||||||
Reference in New Issue
Block a user