mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
We don't have aiohttp support yet, due to which we have to install without cythonized extension. Similarly, there has been some changes in how dataclasses disallows some mutable arguments to be set as a class property, due to which `hydra.conf` fails to import in 3.11. See https://github.com/python/cpython/pull/29867. For now, I have patched the module and avoid importing as a pytest-plugin. dvc-hdfs/pyarrow is not there yet, we'll usually see a release 2-3 months after official reelase. dvc-hdfs is skipped in 3.11 in extras_requires. `--set-params` will return a nice error message if hydra cannot be imported in 3.11. I decided to only patch that in tests.
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
import pytest
|
|
from dvc_http import HTTPFileSystem, HTTPSFileSystem
|
|
from dvc_s3 import S3FileSystem
|
|
from dvc_ssh import SSHFileSystem
|
|
|
|
from dvc.config import RemoteNotFoundError
|
|
from dvc.fs import LocalFileSystem, get_fs_cls, get_fs_config
|
|
|
|
url_cls_pairs = [
|
|
("s3://bucket/path", S3FileSystem),
|
|
("ssh://example.com:/dir/path", SSHFileSystem),
|
|
("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),
|
|
]
|
|
|
|
|
|
try:
|
|
from dvc_hdfs import HDFSFileSystem
|
|
|
|
url_cls_pairs += [("hdfs://example.com/dir/path", HDFSFileSystem)]
|
|
except ImportError:
|
|
pass
|
|
|
|
|
|
@pytest.mark.parametrize("url, cls", url_cls_pairs)
|
|
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")
|