naive test update

This commit is contained in:
Casper da Costa-Luis
2019-08-11 01:21:50 +01:00
parent ee4248df92
commit 120dfff05a
2 changed files with 25 additions and 24 deletions
+3 -2
View File
@@ -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
View File
@@ -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 == ""