From 36c0607b45cfd59c7c1d1d941dbfdfcd34236732 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sat, 29 Mar 2014 13:27:34 +0100 Subject: [PATCH] Loosen up tests again... We shouldn't test item uploading functions in discovery --- tests/storage/__init__.py | 11 +++-------- vdirsyncer/storage/filesystem.py | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/storage/__init__.py b/tests/storage/__init__.py index e9470a8..64c808b 100644 --- a/tests/storage/__init__.py +++ b/tests/storage/__init__.py @@ -98,7 +98,7 @@ class StorageTests(object): assert list(s.list()) def test_discover(self): - collections = {} + collections = set() def main(): for i in range(1, 5): @@ -108,9 +108,7 @@ class StorageTests(object): i += 1 s = self.storage_class( **self.get_storage_args(collection=collection)) - item = self._create_bogus_item(str(i)) - s.upload(item) - collections[s.collection] = normalize_item(item) + collections.add(s.collection) main() # remove leftover variables from loop for safety d = self.storage_class.discover( @@ -124,10 +122,7 @@ class StorageTests(object): # collections, as they are not relevant to us. print('Skipping {}'.format(s.collection)) continue - ((href, etag),) = s.list() - item, etag = s.get(href) - assert collections[s.collection] == normalize_item(item) - del collections[s.collection] + collections.remove(s.collection) main() assert not collections diff --git a/vdirsyncer/storage/filesystem.py b/vdirsyncer/storage/filesystem.py index 31a9338..2051908 100644 --- a/vdirsyncer/storage/filesystem.py +++ b/vdirsyncer/storage/filesystem.py @@ -49,8 +49,7 @@ class FilesystemStorage(Storage): raise TypeError('collection argument must not be given.') for collection in os.listdir(path): s = cls(path=path, collection=collection, **kwargs) - if next(s.list(), None) is not None: - yield s + yield s def _get_filepath(self, href): return os.path.join(self.path, href)