mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-12 07:18:23 +01:00
* remote: move constants into trees * remote: replace Remote() Cache() helper functions * output: update for remote changes * cache/data_cloud: update for remote changes * dependency: update for remote changes * stage: update for remote changes * remote: move remaining non-index methods into tree * tests: update remote unit tests * remote: LocalCache needs to lock remote index, not cache index * fix bugs from moved PARAM_CHECKSUM/PARAM_RELPATH * tests: repo tree open needs state context * remote: make Remote.gc a class method * operates on obj.tree, so that GC can be done with both remote and cache instances * bug fixes * tests: update test_data_cloud * bug fixes * tests: update func tests
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
import pytest
|
|
|
|
from dvc.remote import get_cloud_tree
|
|
from dvc.remote.gs import GSRemoteTree
|
|
from dvc.remote.s3 import S3RemoteTree
|
|
|
|
|
|
def test_remote_with_checksum_jobs(dvc):
|
|
dvc.config["remote"]["with_checksum_jobs"] = {
|
|
"url": "s3://bucket/name",
|
|
"checksum_jobs": 100,
|
|
}
|
|
dvc.config["core"]["checksum_jobs"] = 200
|
|
|
|
tree = get_cloud_tree(dvc, name="with_checksum_jobs")
|
|
assert tree.checksum_jobs == 100
|
|
|
|
|
|
def test_remote_without_checksum_jobs(dvc):
|
|
dvc.config["remote"]["without_checksum_jobs"] = {"url": "s3://bucket/name"}
|
|
dvc.config["core"]["checksum_jobs"] = 200
|
|
|
|
tree = get_cloud_tree(dvc, name="without_checksum_jobs")
|
|
assert tree.checksum_jobs == 200
|
|
|
|
|
|
def test_remote_without_checksum_jobs_default(dvc):
|
|
dvc.config["remote"]["without_checksum_jobs"] = {"url": "s3://bucket/name"}
|
|
|
|
tree = get_cloud_tree(dvc, name="without_checksum_jobs")
|
|
assert tree.checksum_jobs == tree.CHECKSUM_JOBS
|
|
|
|
|
|
@pytest.mark.parametrize("tree_cls", [GSRemoteTree, S3RemoteTree])
|
|
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
|