Просмотр исходного кода

Merge pull request #1713 from ThomasWaldmann/fuse_mount-flexibility

fuse_mount contextmanager: accept any options
enkore 8 лет назад
Родитель
Сommit
dda439be57
2 измененных файлов с 3 добавлено и 5 удалено
  1. 2 4
      borg/testsuite/__init__.py
  2. 1 1
      borg/testsuite/archiver.py

+ 2 - 4
borg/testsuite/__init__.py

@@ -94,11 +94,9 @@ class BaseTestCase(unittest.TestCase):
             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

+ 1 - 1
borg/testsuite/archiver.py

@@ -1119,7 +1119,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
             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):