From 264023c30d5c91e8ed3f7af488d0a6580b8d9270 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sun, 8 Mar 2015 15:00:51 +0100 Subject: [PATCH] Fix bug in filesystem's create_collection --- tests/storage/test_filesystem.py | 16 ++++++---------- vdirsyncer/storage/filesystem.py | 8 ++++---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/tests/storage/test_filesystem.py b/tests/storage/test_filesystem.py index ac395e5..d0fce90 100644 --- a/tests/storage/test_filesystem.py +++ b/tests/storage/test_filesystem.py @@ -14,18 +14,14 @@ from . import StorageTests class TestFilesystemStorage(StorageTests): storage_class = FilesystemStorage - @pytest.fixture(autouse=True) - def setup(self, tmpdir): - self.tmpdir = str(tmpdir) - @pytest.fixture - def get_storage_args(self): - def inner(collection=None): - path = self.tmpdir + def get_storage_args(self, tmpdir): + def inner(collection='test'): + rv = {'path': str(tmpdir), 'fileext': '.txt', 'collection': + collection} if collection is not None: - os.makedirs(os.path.join(path, collection)) - path = os.path.join(path, collection) - return {'path': path, 'fileext': '.txt', 'collection': collection} + rv = self.storage_class.create_collection(**rv) + return rv return inner def test_is_not_directory(self, tmpdir): diff --git a/vdirsyncer/storage/filesystem.py b/vdirsyncer/storage/filesystem.py index 08634c5..c9ee678 100644 --- a/vdirsyncer/storage/filesystem.py +++ b/vdirsyncer/storage/filesystem.py @@ -69,12 +69,12 @@ class FilesystemStorage(Storage): @classmethod def create_collection(cls, collection, **kwargs): - rv = dict(kwargs) + kwargs = dict(kwargs) if collection is not None: - rv['path'] = os.path.join(rv['path'], collection) - checkdir(expand_path(rv['path']), create=True) - rv['collection'] = collection + kwargs['path'] = os.path.join(kwargs['path'], collection) + checkdir(expand_path(kwargs['path']), create=True) + kwargs['collection'] = collection return kwargs def _get_filepath(self, href):