From 916fc4eb30baa3851e20531d53ceb4a0f9a575d2 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Wed, 14 Feb 2018 20:43:33 +0100 Subject: [PATCH] Skip external storage tests if no creds (#718) --- tests/storage/servers/fastmail/__init__.py | 12 ++++++++---- tests/storage/servers/icloud/__init__.py | 11 +++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/storage/servers/fastmail/__init__.py b/tests/storage/servers/fastmail/__init__.py index a421f92..2678972 100644 --- a/tests/storage/servers/fastmail/__init__.py +++ b/tests/storage/servers/fastmail/__init__.py @@ -3,15 +3,19 @@ import os import pytest +username = os.environ.get('FASTMAIL_USERNAME', '').strip() +password = os.environ.get('FASTMAIL_PASSWORD', '').strip() + + class ServerMixin(object): @pytest.fixture def get_storage_args(self, slow_create_collection): + if not username: + pytest.skip('Fastmail credentials not available') + def inner(collection='test'): - args = { - 'username': os.environ['FASTMAIL_USERNAME'], - 'password': os.environ['FASTMAIL_PASSWORD'] - } + args = {'username': username, 'password': password} if self.storage_class.fileext == '.ics': args['url'] = 'https://caldav.messagingengine.com/' diff --git a/tests/storage/servers/icloud/__init__.py b/tests/storage/servers/icloud/__init__.py index f814490..5c4c45c 100644 --- a/tests/storage/servers/icloud/__init__.py +++ b/tests/storage/servers/icloud/__init__.py @@ -2,6 +2,9 @@ import os import pytest +username = os.environ.get('ICLOUD_USERNAME', '').strip() +password = os.environ.get('ICLOUD_PASSWORD', '').strip() + class ServerMixin(object): @@ -12,11 +15,11 @@ class ServerMixin(object): # See https://github.com/pimutils/vdirsyncer/pull/593#issuecomment-285941615 # noqa pytest.skip('iCloud doesn\'t support anything else than VEVENT') + if not username: + pytest.skip('iCloud credentials not available') + def inner(collection='test'): - args = { - 'username': os.environ['ICLOUD_USERNAME'], - 'password': os.environ['ICLOUD_PASSWORD'] - } + args = {'username': username, 'password': password} if self.storage_class.fileext == '.ics': args['url'] = 'https://caldav.icloud.com/'