mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-07 07:18:27 +01:00
* remote: move upload()/download() into tree * remote: move path_info/path_cls into tree * remote.azure: finish moving methods into tree * remote.gs: finish moving methods into tree * remote.hdfs: finish moving methods to tree * remote.http: finish moving methods into tree * remote.oss: finish moving methods into tree * remote.s3: finish moving methods into tree * remote.ssh: finish moving methods into tree * remote.gdrive: finish moving methods into tree * tests: update remote unit tests * tests: update func tests * remote: use walk_files() for all remotes * list_cache_paths() now uses tree.walk_files() for all remotes except local/ssh * fix DS warnings * bugfixes
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
import pytest
|
|
|
|
from dvc.remote import GSRemote, Remote, S3Remote
|
|
|
|
|
|
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
|
|
|
|
remote = Remote(dvc, name="with_checksum_jobs")
|
|
assert remote.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
|
|
|
|
remote = Remote(dvc, name="without_checksum_jobs")
|
|
assert remote.checksum_jobs == 200
|
|
|
|
|
|
def test_remote_without_checksum_jobs_default(dvc):
|
|
dvc.config["remote"]["without_checksum_jobs"] = {"url": "s3://bucket/name"}
|
|
|
|
remote = Remote(dvc, name="without_checksum_jobs")
|
|
assert remote.checksum_jobs == remote.CHECKSUM_JOBS
|
|
|
|
|
|
@pytest.mark.parametrize("remote_cls", [GSRemote, S3Remote])
|
|
def test_makedirs_not_create_for_top_level_path(remote_cls, dvc, mocker):
|
|
url = f"{remote_cls.scheme}://bucket/"
|
|
remote = remote_cls(dvc, {"url": url})
|
|
mocked_client = mocker.PropertyMock()
|
|
# we use remote clients with same name as scheme to interact with remote
|
|
mocker.patch.object(remote_cls.TREE_CLS, remote.scheme, mocked_client)
|
|
|
|
remote.tree.makedirs(remote.path_info)
|
|
assert not mocked_client.called
|