From 9b5e01ab3870352299a3c0817093a2c9196f5203 Mon Sep 17 00:00:00 2001 From: Bernhard Reiter Date: Thu, 20 May 2021 12:50:05 +0200 Subject: [PATCH] Improve storage/test_filesystem with one additional test and fixing of the documentation. --- docs/config.rst | 4 ++-- tests/storage/test_filesystem.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index 454074a..6c35476 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -408,7 +408,7 @@ Local fileext = "..." #encoding = "utf-8" #post_hook = null - #fileextignore = ".tmp" + #fileignoreext = ".tmp" Can be used with `khal `_. See :doc:`vdir` for a more formal description of the format. @@ -427,7 +427,7 @@ Local :param post_hook: A command to call for each item creation and modification. The command will be called with the path of the new/updated file. - :param fileextignore: The file extention to ignore, + :param fileeignoreext: The file extention to ignore, the default is ``.tmp``. .. storage:: singlefile diff --git a/tests/storage/test_filesystem.py b/tests/storage/test_filesystem.py index 20bbf3a..f85c1f3 100644 --- a/tests/storage/test_filesystem.py +++ b/tests/storage/test_filesystem.py @@ -63,6 +63,17 @@ class TestFilesystemStorage(StorageTests): # assert False, tmpdir.listdir() # enable to see the created filename assert len(list(s.list())) == 1 + def test_ignore_files_typical_backup(self, tmpdir): + """Test file-name ignorance with typical backup ending ~.""" + ignorext = "~" # without dot + s = self.storage_class(str(tmpdir), '', fileignoreext="~") + s.upload(Item('UID:xyzxyz')) + item_file, = tmpdir.listdir() + item_file.copy(item_file.new(basename=item_file.basename+'~')) + assert len(tmpdir.listdir()) == 2 + #assert False, tmpdir.listdir() # enable to see the created filename + assert len(list(s.list())) == 1 + def test_too_long_uid(self, tmpdir): s = self.storage_class(str(tmpdir), ".txt") item = Item("UID:" + "hue" * 600)