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