Browse Source

add has_any_fuse flag

Thomas Waldmann 2 weeks ago
parent
commit
7590d1eed4

+ 4 - 0
src/borg/fuse_impl.py

@@ -17,6 +17,7 @@ for FUSE_IMPL in BORG_FUSE_IMPL.split(","):
             has_llfuse = False
             has_pyfuse3 = True
             has_mfusepy = False
+            has_any_fuse = True
             break
     elif FUSE_IMPL == "llfuse":
         try:
@@ -27,6 +28,7 @@ for FUSE_IMPL in BORG_FUSE_IMPL.split(","):
             has_llfuse = True
             has_pyfuse3 = False
             has_mfusepy = False
+            has_any_fuse = True
             break
     elif FUSE_IMPL == "mfusepy":
         try:
@@ -38,6 +40,7 @@ for FUSE_IMPL in BORG_FUSE_IMPL.split(","):
             has_llfuse = False
             has_pyfuse3 = False
             has_mfusepy = True
+            has_any_fuse = True
             break
     elif FUSE_IMPL == "none":
         pass
@@ -48,3 +51,4 @@ else:
     has_llfuse = False
     has_pyfuse3 = False
     has_mfusepy = False
+    has_any_fuse = False

+ 1 - 1
src/borg/testsuite/__init__.py

@@ -20,7 +20,7 @@ try:
 except:  # noqa
     raises = None
 
-from ..fuse_impl import llfuse, has_llfuse, has_pyfuse3, has_mfusepy  # NOQA
+from ..fuse_impl import llfuse, has_any_fuse, has_llfuse, has_pyfuse3, has_mfusepy  # NOQA
 from .. import platform
 from ..platformflags import is_win32, is_darwin
 

+ 8 - 13
src/borg/testsuite/archiver/mount_cmds_test.py

@@ -11,17 +11,12 @@ import sys
 
 import pytest
 
-try:
-    import mfusepy
-except ImportError:
-    mfusepy = None
-
 from ... import xattr, platform
 from ...constants import *  # NOQA
 from ...platform import ENOATTR
 from ...storelocking import Lock
 from ...helpers import flags_noatime, flags_normal
-from .. import has_lchflags, llfuse
+from .. import has_lchflags, has_any_fuse, llfuse
 from .. import changedir, filter_xattrs, same_ts_ns
 from .. import are_symlinks_supported, are_hardlinks_supported, are_fifos_supported
 from ..platform.platform_test import fakeroot_detected
@@ -32,7 +27,7 @@ pytest_generate_tests = lambda metafunc: generate_archiver_tests(metafunc, kinds
 
 
 @requires_hardlinks
-@pytest.mark.skipif(not llfuse and not mfusepy, reason="FUSE not available")
+@pytest.mark.skipif(not has_any_fuse, reason="FUSE not available")
 def test_fuse_mount_hardlinks(archivers, request):
     archiver = request.getfixturevalue(archivers)
     _extract_hardlinks_setup(archiver)
@@ -70,7 +65,7 @@ def test_fuse_mount_hardlinks(archivers, request):
         assert open("input/dir1/subdir/hardlink", "rb").read() == b"123456"
 
 
-@pytest.mark.skipif(not llfuse and not mfusepy, reason="FUSE not available")
+@pytest.mark.skipif(not has_any_fuse, reason="FUSE not available")
 def test_fuse(archivers, request):
     archiver = request.getfixturevalue(archivers)
     if archiver.EXE and fakeroot_detected():
@@ -178,7 +173,7 @@ def test_fuse(archivers, request):
                 raise
 
 
-@pytest.mark.skipif(not llfuse and not mfusepy, reason="FUSE not available")
+@pytest.mark.skipif(not has_any_fuse, reason="FUSE not available")
 def test_fuse_versions_view(archivers, request):
     archiver = request.getfixturevalue(archivers)
     cmd(archiver, "repo-create", RK_ENCRYPTION)
@@ -212,7 +207,7 @@ def test_fuse_versions_view(archivers, request):
             assert open(hl3, "rb").read() == b"123456"
 
 
-@pytest.mark.skipif(not llfuse and not mfusepy, reason="FUSE not available")
+@pytest.mark.skipif(not has_any_fuse, reason="FUSE not available")
 def test_fuse_duplicate_name(archivers, request):
     archiver = request.getfixturevalue(archivers)
     cmd(archiver, "repo-create", RK_ENCRYPTION)
@@ -230,7 +225,7 @@ def test_fuse_duplicate_name(archivers, request):
         assert "unique2" in dirs
 
 
-@pytest.mark.skipif(not llfuse and not mfusepy, reason="FUSE not available")
+@pytest.mark.skipif(not has_any_fuse, reason="FUSE not available")
 def test_fuse_allow_damaged_files(archivers, request):
     archiver = request.getfixturevalue(archivers)
     cmd(archiver, "repo-create", RK_ENCRYPTION)
@@ -260,7 +255,7 @@ def test_fuse_allow_damaged_files(archivers, request):
         assert data.endswith(b"\0\0")
 
 
-@pytest.mark.skipif(not llfuse and not mfusepy, reason="FUSE not available")
+@pytest.mark.skipif(not has_any_fuse, reason="FUSE not available")
 def test_fuse_mount_options(archivers, request):
     archiver = request.getfixturevalue(archivers)
     cmd(archiver, "repo-create", RK_ENCRYPTION)
@@ -283,7 +278,7 @@ def test_fuse_mount_options(archivers, request):
         assert sorted(os.listdir(os.path.join(mountpoint))) == []
 
 
-@pytest.mark.skipif(not llfuse and not mfusepy, reason="FUSE not available")
+@pytest.mark.skipif(not has_any_fuse, reason="FUSE not available")
 def test_migrate_lock_alive(archivers, request):
     """Both old_id and new_id must not be stale during lock migration / daemonization."""
     archiver = request.getfixturevalue(archivers)