From 120dfff05a573ce42f1b542608daecfb961ef840 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 11 Aug 2019 01:18:13 +0100 Subject: [PATCH] naive test update --- tests/func/test_checkout.py | 5 +++-- tests/unit/test_logger.py | 44 ++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/tests/func/test_checkout.py b/tests/func/test_checkout.py index f4b0b6e33..c453ffb5d 100644 --- a/tests/func/test_checkout.py +++ b/tests/func/test_checkout.py @@ -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]) diff --git a/tests/unit/test_logger.py b/tests/unit/test_logger.py index 61da0f22c..1d3ad2edd 100644 --- a/tests/unit/test_logger.py +++ b/tests/unit/test_logger.py @@ -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 == ""