Merge pull request #2189 from Suor/some-fixes

Fix relpath() with PathInfo
This commit is contained in:
Ruslan Kuprieiev
2019-06-26 16:45:20 +03:00
committed by GitHub
2 changed files with 9 additions and 11 deletions
+6 -1
View File
@@ -4,6 +4,7 @@ from unittest import TestCase
import dvc
import pytest
from dvc.system import System
from dvc.path_info import PathInfo
from dvc.utils import relpath
from dvc.utils.compat import str
from dvc.utils.fs import (
@@ -142,5 +143,9 @@ def test_get_parent_dirs_up_to(path1, path2, expected_dirs):
def test_relpath_windows_different_drives():
path1 = os.path.join("A:", os.sep, "some", "path")
path2 = os.path.join("B:", os.sep, "other", "path")
assert relpath(path1, path2) == path1
info1, info2 = PathInfo(path1), PathInfo(path2)
rel_info = relpath(info1, info2)
assert isinstance(rel_info, str)
assert rel_info == path1