From 7c90cbab79094b8372db405bdc28f50d1c192a2c Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 1 Jul 2018 20:40:45 +0300 Subject: [PATCH 1/5] test: test root Signed-off-by: Ruslan Kuprieiev --- tests/test_config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_config.py b/tests/test_config.py index a13379b5c..d582c354b 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -18,6 +18,10 @@ class TestConfigCLI(TestDvc): return True + def test_root(self): + ret = main(['root']) + self.assertEqual(ret, 0) + def test(self): section = 'setsection' field = 'setfield' From 449d4880d1c10ef1a940a1101bcf4b08d94dd35a Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 1 Jul 2018 20:43:34 +0300 Subject: [PATCH 2/5] tests: add test for double install Signed-off-by: Ruslan Kuprieiev --- tests/test_install.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_install.py b/tests/test_install.py index d235bbb05..28b67095f 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -5,11 +5,14 @@ from dvc.main import main from tests.basic_env import TestDvc -class TestInit(TestDvc): +class TestInstall(TestDvc): def test(self): ret = main(['install']) self.assertEqual(ret, 0) + ret = main(['install']) + self.assertNotEqual(ret, 0) + self.assertTrue(os.path.isfile('.git/hooks/post-checkout')) self.dvc.add(self.FOO) From 594b23bd94c5019c78e548a6172b2a8a642c4bc0 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 1 Jul 2018 20:54:03 +0300 Subject: [PATCH 3/5] remote: local: don't return if one target failed to download Signed-off-by: Ruslan Kuprieiev --- dvc/remote/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dvc/remote/local.py b/dvc/remote/local.py index 7a6550881..7ddb6ab95 100644 --- a/dvc/remote/local.py +++ b/dvc/remote/local.py @@ -304,7 +304,7 @@ class RemoteLOCAL(RemoteBase): copyfile(path_info['path'], tmp_file, no_progress_bar=no_progress_bar, name=name) except Exception as exc: Logger.error("Failed to download '{}' to '{}'".format(path_info['path'], path), exc) - return + continue os.rename(tmp_file, path) From e8818ef67a9931a87e9d1dcecab88ccd7c26bdff Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 1 Jul 2018 20:54:43 +0300 Subject: [PATCH 4/5] test: add basic test from `dvc import` cmd Signed-off-by: Ruslan Kuprieiev --- tests/test_import.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/test_import.py diff --git a/tests/test_import.py b/tests/test_import.py new file mode 100644 index 000000000..f1f3630d2 --- /dev/null +++ b/tests/test_import.py @@ -0,0 +1,20 @@ +import os +import stat +import shutil +import filecmp + +from dvc.main import main +from dvc.command.imp import CmdImport + +from tests.basic_env import TestDvc + + +class TestCmdImport(TestDvc): + def test(self): + ret = main(['import', + self.FOO, 'import']) + self.assertEqual(ret, 0) + + ret = main(['import', + 'non-existing-file', 'import']) + self.assertNotEqual(ret, 0) From f274a745a0b787b5dd26d8ed35ddeaf944e174b1 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 1 Jul 2018 21:02:20 +0300 Subject: [PATCH 5/5] tests: checkout: test CLI for single files Signed-off-by: Ruslan Kuprieiev --- tests/test_checkout.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_checkout.py b/tests/test_checkout.py index 95a0b807b..c24c0fcb4 100644 --- a/tests/test_checkout.py +++ b/tests/test_checkout.py @@ -37,8 +37,12 @@ class TestCheckout(TestRepro): class TestCheckoutSingleStage(TestCheckout): def test(self): - self.dvc.checkout(self.foo_stage.path) - self.dvc.checkout(self.data_dir_stage.path) + ret = main(['checkout', self.foo_stage.path]) + self.assertEqual(ret, 0) + + ret = main(['checkout', self.data_dir_stage.path]) + self.assertEqual(ret, 0) + self._test_checkout()