Convert all paths in config to posix-style (#3665)

* Convert all paths in config to posix-style

* Use PathInfo for consistancy, add unit test and change functional tests

* Exclude Windows test on Linux

* Don't patch Config for all the tests!

* Don't do the linux test on Windows either

* De-hackify the unit test, make the functional test more explicit

* tests: adjust tests

Co-authored-by: Charles Baynham <[email protected]>
Co-authored-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
charlesbaynham
2020-04-24 02:47:21 +03:00
committed by GitHub
co-authored by Charles Baynham Ruslan Kuprieiev
parent a2de48bdfb
commit a8b7e33010
4 changed files with 49 additions and 17 deletions
+3 -4
View File
@@ -8,8 +8,7 @@ from dvc.cache import Cache
from dvc.main import main
from dvc.remote.base import DirCacheError
from dvc.utils import relpath
from tests.basic_env import TestDir
from tests.basic_env import TestDvc
from tests.basic_env import TestDir, TestDvc
class TestCache(TestDvc):
@@ -155,7 +154,7 @@ class TestCmdCacheDir(TestDvc):
self.assertEqual(ret, 0)
config = configobj.ConfigObj(self.dvc.config.files["repo"])
self.assertEqual(config["cache"]["dir"], dname)
self.assertEqual(config["cache"]["dir"], dname.replace("\\", "/"))
def test_relative_path(self):
tmpdir = self.mkdtemp()
@@ -167,7 +166,7 @@ class TestCmdCacheDir(TestDvc):
# dir path written to config should be just one level above.
rel = os.path.join("..", dname)
config = configobj.ConfigObj(self.dvc.config.files["repo"])
self.assertEqual(config["cache"]["dir"], rel)
self.assertEqual(config["cache"]["dir"], rel.replace("\\", "/"))
ret = main(["add", self.FOO])
self.assertEqual(ret, 0)