mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-06 15:28:28 +01:00
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
import pytest
|
|
from dvc_http import HTTPFileSystem, HTTPSFileSystem
|
|
from dvc_ssh import SSHFileSystem
|
|
|
|
from dvc.config import RemoteNotFoundError
|
|
from dvc.fs import (
|
|
HDFSFileSystem,
|
|
LocalFileSystem,
|
|
S3FileSystem,
|
|
get_fs_cls,
|
|
get_fs_config,
|
|
)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"url, cls",
|
|
[
|
|
("s3://bucket/path", S3FileSystem),
|
|
("ssh://example.com:/dir/path", SSHFileSystem),
|
|
("hdfs://example.com/dir/path", HDFSFileSystem),
|
|
("http://example.com/path/to/file", HTTPFileSystem),
|
|
("https://example.com/path/to/file", HTTPSFileSystem),
|
|
("path/to/file", LocalFileSystem),
|
|
("path\\to\\file", LocalFileSystem),
|
|
("file", LocalFileSystem),
|
|
("./file", LocalFileSystem),
|
|
(".\\file", LocalFileSystem),
|
|
("../file", LocalFileSystem),
|
|
("..\\file", LocalFileSystem),
|
|
("unknown://path", LocalFileSystem),
|
|
],
|
|
)
|
|
def test_get_fs_cls(url, cls):
|
|
assert get_fs_cls({"url": url}) == cls
|
|
|
|
|
|
def test_get_fs_config():
|
|
with pytest.raises(RemoteNotFoundError):
|
|
get_fs_config(None, {"remote": {}}, name="myremote")
|