mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Test without optional packages
Tox: * Add Tox factor for extras (all, none, individual ESP). For now, only break out ESPs that have specific extra dependencies (amazon_ses, sparkpost). * Install most package dependencies (including extras) through the package itself. * Use new runtests.py environment vars to limit test tags when Tox isn't installing all extras. Travis: * Rework matrix to request specific TOXENVs directly; drop tox-travis. Test runner (runtests.py): * Centralize RUN_LIVE_TESTS logic in runtests.py * Add ANYMAIL_ONLY_TEST and ANYMAIL_SKIP_TESTS env vars (comma-separated lists of tags) Test implementations: * Tag all ESP-specific tests with ESP * Tag live tests with "live" * Don't import ESP-specific packages at test module level. (Test discovery imports test modules before tag-based filtering.) Closes #104
This commit is contained in:
@@ -8,32 +8,12 @@ import uuid
|
||||
import warnings
|
||||
from base64 import b64decode
|
||||
from contextlib import contextmanager
|
||||
from distutils.util import strtobool
|
||||
|
||||
import six
|
||||
from django.test import Client
|
||||
from six.moves import StringIO
|
||||
|
||||
|
||||
def envbool(var, default=False):
|
||||
"""Returns value of environment variable var as a bool, or default if not set.
|
||||
|
||||
Converts `'true'` to `True`, and `'false'` to `False`.
|
||||
See :func:`~distutils.util.strtobool` for full list of allowable values.
|
||||
"""
|
||||
val = os.getenv(var, None)
|
||||
if val is None:
|
||||
return default
|
||||
else:
|
||||
return strtobool(val)
|
||||
|
||||
|
||||
# RUN_LIVE_TESTS: whether to run live API integration tests.
|
||||
# True by default, except in CONTINUOUS_INTEGRATION job.
|
||||
# (See comments and overrides in .travis.yml.)
|
||||
RUN_LIVE_TESTS = envbool('RUN_LIVE_TESTS', default=not envbool('CONTINUOUS_INTEGRATION'))
|
||||
|
||||
|
||||
def decode_att(att):
|
||||
"""Returns the original data from base64-encoded attachment content"""
|
||||
return b64decode(att.encode('ascii'))
|
||||
|
||||
Reference in New Issue
Block a user