From 7590d1eed4ac790092cdcdc8f629aa8ba2feba35 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 5 Dec 2025 18:22:21 +0100 Subject: [PATCH] add has_any_fuse flag --- src/borg/fuse_impl.py | 4 ++++ src/borg/testsuite/__init__.py | 2 +- .../testsuite/archiver/mount_cmds_test.py | 21 +++++++------------ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/borg/fuse_impl.py b/src/borg/fuse_impl.py index 0624a3414..446f27ccd 100644 --- a/src/borg/fuse_impl.py +++ b/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 diff --git a/src/borg/testsuite/__init__.py b/src/borg/testsuite/__init__.py index 0339650f2..e4b7cfd5c 100644 --- a/src/borg/testsuite/__init__.py +++ b/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 diff --git a/src/borg/testsuite/archiver/mount_cmds_test.py b/src/borg/testsuite/archiver/mount_cmds_test.py index 34266a788..e13f1450e 100644 --- a/src/borg/testsuite/archiver/mount_cmds_test.py +++ b/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)