From 9b5b4874ad5406a4297fa31222fca215e2214656 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 13 Sep 2017 20:51:25 +0300 Subject: [PATCH 1/3] tests: use python in repro test Signed-off-by: Ruslan Kuprieiev --- functest/test-repro-code.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functest/test-repro-code.sh b/functest/test-repro-code.sh index 58d071f3d..4f083bfa1 100755 --- a/functest/test-repro-code.sh +++ b/functest/test-repro-code.sh @@ -9,8 +9,7 @@ dvc_create_repo mkdir data/tsv dvc_info 'Convert Budget.xml to tsv' -pip2 install xmltodict -dvc run --code code/xmltotsv.py python2 code/xmltotsv.py --extract row/@Id,row/@UserId,row/@Name,row/@Class,row/@TagBased,row/@Date data/xml/Badges.xml data/tsv/Badges.tsv +dvc run --code code/xmltotsv.py python code/xmltotsv.py --extract row/@Id,row/@UserId,row/@Name,row/@Class,row/@TagBased,row/@Date data/xml/Badges.xml data/tsv/Badges.tsv dvc_info 'Modify code' echo " " >> code/xmltotsv.py From 52cf1efd8b1f721d65732d16b171040d83d02b21 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 13 Sep 2017 20:03:33 +0300 Subject: [PATCH 2/3] tests: fix test_workflow Signed-off-by: Ruslan Kuprieiev --- tests/test_workflow.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/test_workflow.py b/tests/test_workflow.py index e497a9f3f..45b77ea26 100644 --- a/tests/test_workflow.py +++ b/tests/test_workflow.py @@ -27,10 +27,14 @@ class TestWorkflow(TestCase): self.assertEqual(len(wf._commits), 4) - self.assertEqual(wf._commits['1'].text, self._commit1._comment + '\n' + self._commit1.hash) - self.assertEqual(wf._commits['2'].text, self._commit2._comment + '\n' + self._commit2.hash) - self.assertEqual(wf._commits['3'].text, self._commit3._comment + '\n' + self._commit3.hash) - self.assertEqual(wf._commits['4'].text, self._commit4._comment + '\n' + self._commit4.hash) + self.assertEqual(wf._commits['1'].text, + self._commit1._comment + '\n' + self._commit1._text_hash()) + self.assertEqual(wf._commits['2'].text, + self._commit2._comment + '\n' + self._commit2._text_hash()) + self.assertEqual(wf._commits['3'].text, + self._commit3._comment + '\n' + self._commit3._text_hash()) + self.assertEqual(wf._commits['4'].text, + self._commit4._comment + '\n' + self._commit4._text_hash()) pass def collapse_test(self): @@ -43,7 +47,8 @@ class TestWorkflow(TestCase): wf.collapse_repro_commits() self.assertEqual(len(wf._commits), 3) - self.assertEqual(wf._commits[self._commit1.hash].text, self._commit1._comment + '\n' + self._commit1.hash) + self.assertEqual(wf._commits[self._commit1.hash].text, + self._commit1._comment + '\n' + self._commit1._text_hash()) self.assertEqual(wf._commits[self._commit3.hash].text, Commit.COLLAPSED_TEXT) self.assertTrue('2' not in wf._commits) @@ -61,7 +66,8 @@ class TestWorkflow(TestCase): wf.collapse_repro_commits() self.assertEqual(len(wf._commits), 2) - self.assertEqual(wf._commits[self._commit1.hash].text, self._commit1._comment + '\n' + self._commit1.hash) + self.assertEqual(wf._commits[self._commit1.hash].text, + self._commit1._comment + '\n' + self._commit1._text_hash()) self.assertEqual(wf._commits[self._commit3.hash].text, Commit.COLLAPSED_TEXT) self.assertTrue('2' not in wf._commits) pass @@ -83,4 +89,4 @@ class TestWorkflow(TestCase): self.assertEqual(wf._commits['3']._target_metric, value) self.assertEqual(wf._commits['3'].branch_tips, branches) - pass \ No newline at end of file + pass From fc901c03ed59b9657900dd1edbc1df441fa41d14 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 13 Sep 2017 19:17:20 +0300 Subject: [PATCH 3/3] pull: create dirs before pulling Fixes #201 Signed-off-by: Ruslan Kuprieiev --- dvc/data_cloud.py | 3 +-- functest/test-sync-aws.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dvc/data_cloud.py b/dvc/data_cloud.py index 29f7d6275..5df1b28c8 100644 --- a/dvc/data_cloud.py +++ b/dvc/data_cloud.py @@ -148,7 +148,7 @@ class DataCloudBase(object): def pull(self, item): fname = item.resolved_cache.dvc key_name = self.cache_file_key(fname) - + self.create_directory(item) return self._import(self.storage_bucket, key_name, fname, item) def import_data(self, url, item): @@ -162,7 +162,6 @@ class DataCloudBase(object): if os.path.isfile(item.resolved_cache.dvc): return self.push(item) else: - self.create_directory(item) return self.pull(item) def create_directory(self, item): diff --git a/functest/test-sync-aws.sh b/functest/test-sync-aws.sh index 798565c13..736bf982d 100755 --- a/functest/test-sync-aws.sh +++ b/functest/test-sync-aws.sh @@ -33,6 +33,15 @@ if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_SECURE_ENV_VARS" == "true" ] dvc_info "Checking status" dvc status data/xml + dvc_info "Removing all cache" + rm -rf .cache/xml + + dvc_info "Checking status" + dvc status data/xml + + dvc_info "Pulling data" + dvc pull data/xml + dvc_clean_cloud_aws fi