Files
dvc/tests/func/test_output.py
T
Saugat Pachhai 5faae2a6e9 test: allow selectively running tests for remotes (#4920)
Some of the tests are run by default, other requires
`--enable-{remote}` to run. The remotes that are run by default
also have a `--disable-{remote}` flag. All of the remotes can be
enabled using `--all` flag.

To use this functionality in the fixture,
`test_config` fixture has to be used, and requires to call
`test_config.requires(remote)`.
In an individual test, you can simply use `pytest.mark.remote`
to make them skip or run.
2020-11-23 11:43:39 +05:45

37 lines
981 B
Python

import pytest
from dvc.output import OUTS_MAP, _get
from dvc.stage import Stage
from tests import PY39, PYARROW_NOT_AVAILABLE
MARKERS = [
pytest.mark.skipif(PY39, reason=PYARROW_NOT_AVAILABLE),
pytest.mark.hdfs,
]
TESTS = [
("s3://bucket/path", "s3"),
("gs://bucket/path", "gs"),
("ssh://example.com:/dir/path", "ssh"),
("path/to/file", "local"),
("path\\to\\file", "local"),
("file", "local"),
("./file", "local"),
(".\\file", "local"),
("../file", "local"),
("..\\file", "local"),
("unknown://path", "local"),
pytest.param("hdfs://example.com/dir/path", "hdfs", marks=MARKERS),
pytest.param("hdfs://example.com/dir/path", "hdfs", marks=MARKERS),
]
def _get_out(dvc, path):
return _get(Stage(dvc), path, None, None, None, None)
@pytest.mark.parametrize("url,scheme", TESTS)
def test_scheme(dvc, url, scheme):
# pylint: disable=unidiomatic-typecheck
assert type(_get_out(dvc, url)) == OUTS_MAP[scheme]