diff --git a/dvc/command/version.py b/dvc/command/version.py index ad041b4dd..3e2b780f0 100644 --- a/dvc/command/version.py +++ b/dvc/command/version.py @@ -5,6 +5,7 @@ import platform import argparse import logging import uuid +import itertools try: import psutil @@ -69,9 +70,12 @@ class CmdVersion(CmdBaseNoRepo): def get_fs_type(path): partition = { pathlib.Path(part.mountpoint): (part.fstype, part.device) - for part in psutil.disk_partitions() + for part in psutil.disk_partitions(all=True) } - for parent in pathlib.Path(path).parents: + + path = pathlib.Path(path) + + for parent in itertools.chain([path], path.parents): if parent in partition: return partition[parent] return ("unkown", "none") diff --git a/setup.py b/setup.py index 899a07adb..19408761d 100644 --- a/setup.py +++ b/setup.py @@ -113,6 +113,7 @@ tests_requirements = [ "Pygments", # required by collective.checkdocs, "collective.checkdocs", "flake8", + "psutil", "flake8-docstrings", "pydocstyle<4.0", "jaraco.windows==3.9.2", diff --git a/tests/unit/remote/ssh/test_connection.py b/tests/unit/remote/ssh/test_connection.py index f90308e54..7c02c8012 100644 --- a/tests/unit/remote/ssh/test_connection.py +++ b/tests/unit/remote/ssh/test_connection.py @@ -5,8 +5,10 @@ import posixpath import platform import pytest import filecmp +import tempfile from dvc.system import System +from dvc.command.version import CmdVersion here = os.path.abspath(os.path.dirname(__file__)) @@ -73,7 +75,9 @@ def test_walk(tmp_path, ssh): @pytest.mark.skipif( - platform.system() != "Darwin", reason="Only works on OSX (because of APFS)" + CmdVersion.get_fs_type(tempfile.gettempdir())[0] + not in ["xfs", "apfs", "btrfs"], + reason="Reflinks only work in specified file systems", ) def test_reflink(repo_dir, ssh): ssh.reflink("foo", "link") @@ -82,6 +86,10 @@ def test_reflink(repo_dir, ssh): assert not System.is_hardlink("link") +@pytest.mark.skipif( + platform.system() != "Windows", + reason="sftp symlink is not supported on Windows", +) def test_symlink(repo_dir, ssh): ssh.symlink("foo", "link") assert System.is_symlink("link")