Files
dvc/tests/unit/remote/test_remote.py
T
Ruslan Kuprieiev a077135d76 Consolidate trees (#4243)
* dvc: get rid of is_walking_tree

No longer needed. Some applications of `isinstance()` will be refactored
in the future, as trees will just provide the needed functionality.

* dvc: move GitTree to dvc/tree/

* dvc: rename *RemoteTree to *Tree
2020-07-19 18:43:16 +03:00

44 lines
1.3 KiB
Python

import pytest
from dvc.tree import get_cloud_tree
from dvc.tree.gs import GSTree
from dvc.tree.s3 import S3Tree
def test_remote_with_hash_jobs(dvc):
dvc.config["remote"]["with_hash_jobs"] = {
"url": "s3://bucket/name",
"hash_jobs": 100,
}
dvc.config["core"]["hash_jobs"] = 200
tree = get_cloud_tree(dvc, name="with_hash_jobs")
assert tree.hash_jobs == 100
def test_remote_without_hash_jobs(dvc):
dvc.config["remote"]["without_hash_jobs"] = {"url": "s3://bucket/name"}
dvc.config["core"]["hash_jobs"] = 200
tree = get_cloud_tree(dvc, name="without_hash_jobs")
assert tree.hash_jobs == 200
def test_remote_without_hash_jobs_default(dvc):
dvc.config["remote"]["without_hash_jobs"] = {"url": "s3://bucket/name"}
tree = get_cloud_tree(dvc, name="without_hash_jobs")
assert tree.hash_jobs == tree.HASH_JOBS
@pytest.mark.parametrize("tree_cls", [GSTree, S3Tree])
def test_makedirs_not_create_for_top_level_path(tree_cls, dvc, mocker):
url = f"{tree_cls.scheme}://bucket/"
tree = tree_cls(dvc, {"url": url})
mocked_client = mocker.PropertyMock()
# we use remote clients with same name as scheme to interact with remote
mocker.patch.object(tree_cls, tree.scheme, mocked_client)
tree.makedirs(tree.path_info)
assert not mocked_client.called