瀏覽代碼

Add a couple of missing tests (#251).

Dan Helfman 6 月之前
父節點
當前提交
1366269586

+ 2 - 0
borgmatic/config/schema.yaml

@@ -2302,3 +2302,5 @@ properties:
                 description: |
                 description: |
                     Command to use instead of "findmnt".
                     Command to use instead of "findmnt".
                 example: /usr/local/bin/findmnt
                 example: /usr/local/bin/findmnt
+        description: |
+            Configuration for integration with the Btrfs filesystem.

+ 0 - 1
borgmatic/hooks/data_source/btrfs.py

@@ -1,4 +1,3 @@
-import functools
 import glob
 import glob
 import logging
 import logging
 import os
 import os

+ 16 - 0
tests/unit/config/test_paths.py

@@ -45,6 +45,22 @@ def test_replace_temporary_subdirectory_with_glob_transforms_path():
     )
     )
 
 
 
 
+def test_replace_temporary_subdirectory_with_glob_passes_through_non_matching_path():
+    assert (
+        module.replace_temporary_subdirectory_with_glob('/tmp/foo-aet8kn93/borgmatic')
+        == '/tmp/foo-aet8kn93/borgmatic'
+    )
+
+
+def test_replace_temporary_subdirectory_with_glob_uses_custom_temporary_directory_prefix():
+    assert (
+        module.replace_temporary_subdirectory_with_glob(
+            '/tmp/.borgmatic-aet8kn93/borgmatic', temporary_directory_prefix='.borgmatic-'
+        )
+        == '/tmp/.borgmatic-*/borgmatic'
+    )
+
+
 def test_runtime_directory_uses_config_option():
 def test_runtime_directory_uses_config_option():
     flexmock(module).should_receive('expand_user_in_path').replace_with(lambda path: path)
     flexmock(module).should_receive('expand_user_in_path').replace_with(lambda path: path)
     flexmock(module.os).should_receive('makedirs')
     flexmock(module.os).should_receive('makedirs')

+ 0 - 1
tests/unit/hooks/data_source/test_btrfs.py

@@ -1,4 +1,3 @@
-import pytest
 from flexmock import flexmock
 from flexmock import flexmock
 
 
 from borgmatic.hooks.data_source import btrfs as module
 from borgmatic.hooks.data_source import btrfs as module