1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-22 22:22:27 +00:00

fuse_mount contextmanager: accept any options

not just the -o mount_options, but any options borg mount would take.
simpler, more flexible.
This commit is contained in:
Thomas Waldmann 2016-10-13 03:53:26 +02:00
parent f7d20f8eee
commit 8d9475f704
2 changed files with 3 additions and 5 deletions

View file

@ -94,11 +94,9 @@ def _assert_dirs_equal_cmp(self, diff):
self._assert_dirs_equal_cmp(sub_diff)
@contextmanager
def fuse_mount(self, location, mountpoint, mount_options=None):
def fuse_mount(self, location, mountpoint, *options):
os.mkdir(mountpoint)
args = ['mount', location, mountpoint]
if mount_options:
args += '-o', mount_options
args = ['mount', location, mountpoint] + list(options)
self.cmd(*args, fork=True)
self.wait_for_mount(mountpoint)
yield

View file

@ -1119,7 +1119,7 @@ def test_fuse_allow_damaged_files(self):
with pytest.raises(OSError) as excinfo:
open(os.path.join(mountpoint, path))
assert excinfo.value.errno == errno.EIO
with self.fuse_mount(self.repository_location + '::archive', mountpoint, 'allow_damaged_files'):
with self.fuse_mount(self.repository_location + '::archive', mountpoint, '-o', 'allow_damaged_files'):
open(os.path.join(mountpoint, path)).close()
def verify_aes_counter_uniqueness(self, method):