Skip to content

Commit 9b5e01a

Browse files
Improve storage/test_filesystem
with one additional test and fixing of the documentation.
1 parent 81895c2 commit 9b5e01a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

docs/config.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ Local
408408
fileext = "..."
409409
#encoding = "utf-8"
410410
#post_hook = null
411-
#fileextignore = ".tmp"
411+
#fileignoreext = ".tmp"
412412

413413
Can be used with `khal <http://lostpackets.de/khal/>`_. See :doc:`vdir` for
414414
a more formal description of the format.
@@ -427,7 +427,7 @@ Local
427427
:param post_hook: A command to call for each item creation and
428428
modification. The command will be called with the path of the
429429
new/updated file.
430-
:param fileextignore: The file extention to ignore,
430+
:param fileeignoreext: The file extention to ignore,
431431
the default is ``.tmp``.
432432

433433
.. storage:: singlefile

tests/storage/test_filesystem.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ def test_ignore_tmp_files_empty_fileext(self, tmpdir):
6363
# assert False, tmpdir.listdir() # enable to see the created filename
6464
assert len(list(s.list())) == 1
6565

66+
def test_ignore_files_typical_backup(self, tmpdir):
67+
"""Test file-name ignorance with typical backup ending ~."""
68+
ignorext = "~" # without dot
69+
s = self.storage_class(str(tmpdir), '', fileignoreext="~")
70+
s.upload(Item('UID:xyzxyz'))
71+
item_file, = tmpdir.listdir()
72+
item_file.copy(item_file.new(basename=item_file.basename+'~'))
73+
assert len(tmpdir.listdir()) == 2
74+
#assert False, tmpdir.listdir() # enable to see the created filename
75+
assert len(list(s.list())) == 1
76+
6677
def test_too_long_uid(self, tmpdir):
6778
s = self.storage_class(str(tmpdir), ".txt")
6879
item = Item("UID:" + "hue" * 600)

0 commit comments

Comments
 (0)