diff --git a/tests/storage/__init__.py b/tests/storage/__init__.py index 154143d..d9b2ca5 100644 --- a/tests/storage/__init__.py +++ b/tests/storage/__init__.py @@ -11,6 +11,7 @@ from vdirsyncer.storage.base import Item import vdirsyncer.exceptions as exceptions from .. import assert_item_equals import random +import pytest class StorageTests(object): @@ -47,7 +48,8 @@ class StorageTests(object): s = self._get_storage() item = self._create_bogus_item(1) s.upload(item) - self.assertRaises(exceptions.PreconditionFailed, s.upload, item) + with pytest.raises(exceptions.PreconditionFailed): + s.upload(item) def test_upload(self): s = self._get_storage() @@ -68,23 +70,24 @@ class StorageTests(object): def test_update_nonexisting(self): s = self._get_storage() item = self._create_bogus_item(1) - self.assertRaises(exceptions.PreconditionFailed, - s.update, s._get_href('1'), item, 123) - self.assertRaises(exceptions.PreconditionFailed, - s.update, 'huehue', item, 123) + with pytest.raises(exceptions.PreconditionFailed): + s.update(s._get_href('1'), item, 123) + with pytest.raises(exceptions.PreconditionFailed): + s.update('huehue', item, 123) def test_wrong_etag(self): s = self._get_storage() obj = self._create_bogus_item(1) href, etag = s.upload(obj) - self.assertRaises( - exceptions.PreconditionFailed, s.update, href, obj, 'lolnope') - self.assertRaises( - exceptions.PreconditionFailed, s.delete, href, 'lolnope') + with pytest.raises(exceptions.PreconditionFailed): + s.update(href, obj, 'lolnope') + with pytest.raises(exceptions.PreconditionFailed): + s.delete(href, 'lolnope') def test_delete_nonexisting(self): s = self._get_storage() - self.assertRaises(exceptions.PreconditionFailed, s.delete, '1', 123) + with pytest.raises(exceptions.PreconditionFailed): + s.delete('1', 123) def test_list(self): s = self._get_storage() diff --git a/tests/storage/dav/test_caldav.py b/tests/storage/dav/test_caldav.py index 32cac4e..8c94ceb 100644 --- a/tests/storage/dav/test_caldav.py +++ b/tests/storage/dav/test_caldav.py @@ -43,7 +43,7 @@ END:VEVENT END:VCALENDAR''' -class CaldavStorageTests(TestCase, DavStorageTests): +class TestCaldavStorage(DavStorageTests): storage_class = CaldavStorage item_template = TASK_TEMPLATE diff --git a/tests/storage/dav/test_carddav.py b/tests/storage/dav/test_carddav.py index 940477b..6ed1173 100644 --- a/tests/storage/dav/test_carddav.py +++ b/tests/storage/dav/test_carddav.py @@ -14,7 +14,7 @@ from vdirsyncer.storage.dav.carddav import CarddavStorage from . import DavStorageTests -class CarddavStorageTests(TestCase, DavStorageTests): +class TestCarddavStorage(DavStorageTests): storage_class = CarddavStorage item_template = (u'BEGIN:VCARD\n' diff --git a/tests/storage/test_filesystem.py b/tests/storage/test_filesystem.py index 5d93e62..d040145 100644 --- a/tests/storage/test_filesystem.py +++ b/tests/storage/test_filesystem.py @@ -8,7 +8,6 @@ :license: MIT, see LICENSE for more details. ''' -from unittest import TestCase import pytest import os from vdirsyncer.storage.filesystem import FilesystemStorage @@ -16,7 +15,7 @@ from . import StorageTests @pytest.mark.usefixtures('class_tmpdir') -class FilesystemStorageTests(TestCase, StorageTests): +class TestFilesystemStorage(StorageTests): storage_class = FilesystemStorage def get_storage_args(self, collection=None): diff --git a/tests/storage/test_http.py b/tests/storage/test_http.py index c4553a6..ba6771d 100644 --- a/tests/storage/test_http.py +++ b/tests/storage/test_http.py @@ -14,7 +14,7 @@ from textwrap import dedent from vdirsyncer.storage.http import HttpStorage, Item -class HttpStorageTests(TestCase): +class TestHttpStorage(object): def test_list(self): collection_url = 'http://127.0.0.1/calendar/collection/' diff --git a/tests/storage/test_memory.py b/tests/storage/test_memory.py index eca9184..72c0160 100644 --- a/tests/storage/test_memory.py +++ b/tests/storage/test_memory.py @@ -13,7 +13,7 @@ from vdirsyncer.storage.memory import MemoryStorage from . import StorageTests -class MemoryStorageTests(TestCase, StorageTests): +class TestMemoryStorage(StorageTests): storage_class = MemoryStorage diff --git a/tests/test_cli.py b/tests/test_cli.py index 2097521..f120f5b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -7,10 +7,9 @@ :license: MIT, see LICENSE for more details. ''' -from unittest import TestCase import vdirsyncer.cli as cli import vdirsyncer.exceptions as exceptions -class CliTests(TestCase): +class TestCli(object): pass