Files
dvc/tests/unit/test_state.py
T
Casper da Costa-Luis 2bb7257a06 lint: isort pre-commit & misc improvements (#3749)
* test: clean flake8 config root clutter

* test: pre-commit: add isort

Compatible with black (see https://github.com/timothycrosley/isort/issues/694)

* lint: reorder imports

* lint: more complex imports

* lint: fix deepsource

* config: isort: add first party dvc

* tests: restyled: add isort

* temp commit to revert before merge

* Revert "temp commit to revert before merge"

This reverts commit 11db0fd8e95fe891597cbb9bf804480909b19e24.
2020-05-06 23:56:07 +03:00

24 lines
885 B
Python

import pytest
from dvc.state import _build_sqlite_uri
@pytest.mark.parametrize(
"path, osname, result",
[
("/abs/path", "posix", "file:///abs/path"),
("C:\\abs\\path", "nt", "file:///C:/abs/path"),
("/abs/p?ath", "posix", "file:///abs/p%3fath"),
("C:\\abs\\p?ath", "nt", "file:///C:/abs/p%3fath"),
("/abs/p#ath", "posix", "file:///abs/p%23ath"),
("C:\\abs\\p#ath", "nt", "file:///C:/abs/p%23ath"),
("/abs/path space", "posix", "file:///abs/path space"),
("C:\\abs\\path space", "nt", "file:///C:/abs/path space"),
("/abs/path%20encoded", "posix", "file:///abs/path%2520encoded"),
("C:\\abs\\path%20encoded", "nt", "file:///C:/abs/path%2520encoded"),
],
)
def test_build_uri(path, osname, result, mocker):
mocker.patch("os.name", osname)
assert _build_sqlite_uri(path, {}) == result