Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dvc/fs/dvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _get_key(self, path):

fs_key = "repo"
key = self.path.parts(path)
if key == (".",):
if key == (".",) or key == ("",):
key = ()

return (fs_key, *key)
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/fs/test_dvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@
from dvc.utils.fs import remove


@pytest.mark.parametrize(
"path, key",
[
("", ("repo",)),
(".", ("repo",)),
("foo", ("repo", "foo")),
(os.path.join("dir", "foo"), ("repo", "dir", "foo")),
],
)
def test_get_key(tmp_dir, dvc, path, key):
fs = DvcFileSystem(repo=dvc)
assert fs._get_key(path) == key
Comment on lines +22 to +24
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed before, a bit of an overkill to use real dvc in unit tests, but still kept using them in this one for simplicity. #7408 is a start to moving to fsspec, where we will scrap most of these tests for something better.



def test_exists(tmp_dir, dvc):
tmp_dir.gen("foo", "foo")
dvc.add("foo")
Expand Down