Drop support for Django < 1.11

This commit is contained in:
medmunds
2018-05-30 15:20:47 -07:00
parent 23f44dce2d
commit 3a47042269
8 changed files with 10 additions and 383 deletions

View File

@@ -37,20 +37,6 @@ matrix:
# Django development master (direct from GitHub source): # Django development master (direct from GitHub source):
- { env: DJANGO=master, python: 3.7-dev } - { env: DJANGO=master, python: 3.7-dev }
# Obsolete Django versions (no longer supported by Django)
# Anymail tries to support these, but doesn't test every possible combination...
# Django 1.8: Python 2.7, 3.3, 3.4, 3.5
- { env: DJANGO=1.8, python: 2.7 }
- { env: DJANGO=1.8, python: 3.4 }
- { env: DJANGO=1.8, python: 3.5 }
- { env: DJANGO=1.8, python: pypy }
# Django 1.9: Python 2.7, 3.4, 3.5
- { env: DJANGO=1.9, python: 2.7 }
- { env: DJANGO=1.9, python: 3.5 }
# Django 1.10: Python 2.7, 3.4, 3.5
- { env: DJANGO=1.10, python: 2.7 }
- { env: DJANGO=1.10, python: 3.5 }
allow_failures: allow_failures:
- env: DJANGO=master - env: DJANGO=master
python: 3.7-dev python: 3.7-dev

View File

@@ -41,7 +41,7 @@ built-in `django.core.mail` package. It includes:
with simplified, portable access to attachments and other inbound content with simplified, portable access to attachments and other inbound content
Anymail is released under the BSD license. It is extensively tested against Anymail is released under the BSD license. It is extensively tested against
Django 1.8--2.1 (including Python 2.7, Python 3 and PyPy). Django 1.11--2.1 (including Python 2.7, Python 3 and PyPy).
Anymail releases follow `semantic versioning <http://semver.org/>`_. Anymail releases follow `semantic versioning <http://semver.org/>`_.
.. END shared-intro .. END shared-intro

View File

@@ -43,7 +43,7 @@ setup(
license="BSD License", license="BSD License",
packages=["anymail"], packages=["anymail"],
zip_safe=False, zip_safe=False,
install_requires=["django>=1.8", "requests>=2.4.3", "six"], install_requires=["django>=1.11", "requests>=2.4.3", "six"],
extras_require={ extras_require={
# This can be used if particular backends have unique dependencies. # This can be used if particular backends have unique dependencies.
# For simplicity, requests is included in the base requirements. # For simplicity, requests is included in the base requirements.
@@ -76,9 +76,6 @@ setup(
"Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Libraries :: Python Modules",
"Intended Audience :: Developers", "Intended Audience :: Developers",
"Framework :: Django", "Framework :: Django",
"Framework :: Django :: 1.8",
"Framework :: Django :: 1.9",
"Framework :: Django :: 1.10",
"Framework :: Django :: 1.11", "Framework :: Django :: 1.11",
"Framework :: Django :: 2.0", "Framework :: Django :: 2.0",
# "Framework :: Django :: 2.1", # "Framework :: Django :: 2.1",

View File

@@ -1,121 +0,0 @@
"""
Django settings for Anymail tests.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'NOT_FOR_PRODUCTION_USE'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'anymail',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'tests.test_settings.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'tests.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'

View File

@@ -1,103 +0,0 @@
"""
Django settings for Anymail tests.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'NOT_FOR_PRODUCTION_USE'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'anymail',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'tests.test_settings.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'tests.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'

View File

@@ -1,122 +0,0 @@
"""
Django settings for Anymail tests.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'NOT_FOR_PRODUCTION_USE'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'anymail',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'tests.test_settings.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'tests.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'

View File

@@ -95,10 +95,9 @@ class AnymailTestMixin:
"""Helpful additional methods for Anymail tests""" """Helpful additional methods for Anymail tests"""
def assertLogs(self, logger=None, level=None): def assertLogs(self, logger=None, level=None):
# Note: Django 1.8's django.utils.log.DEFAULT_LOGGING config is set to *not* propagate # Note: django.utils.log.DEFAULT_LOGGING config is set to *not* propagate certain
# certain logging records. That means you *can't* capture those logs at the root (None) logger. # logging records. That means you *can't* capture those logs at the root (None) logger.
# (If you really need that, you could override LOGGING in tests.settings.settings_1_8.) assert logger is not None # `None` root logger won't reliably capture
assert logger is not None # `None` root logger won't reliably capture on Django 1.8
try: try:
return super(AnymailTestMixin, self).assertLogs(logger, level) return super(AnymailTestMixin, self).assertLogs(logger, level)
except (AttributeError, TypeError): except (AttributeError, TypeError):
@@ -303,7 +302,7 @@ class _AssertWarnsContext(object):
class ClientWithCsrfChecks(Client): class ClientWithCsrfChecks(Client):
"""Django test Client that enforces CSRF checks """Django test Client that enforces CSRF checks
https://docs.djangoproject.com/en/1.9/ref/csrf/#testing https://docs.djangoproject.com/en/stable/ref/csrf/#testing
""" """
def __init__(self, **defaults): def __init__(self, **defaults):

17
tox.ini
View File

@@ -3,25 +3,19 @@ envlist =
# Test these environments first, to catch most errors early... # Test these environments first, to catch most errors early...
lint lint
django20-py36 django20-py36
django18-py27 django111-py27
docs docs
# ... then test all the other supported combinations: # ... then test all the other supported combinations:
django20-py{35,py3} django20-py{35,py3}
django111-py{27,34,35,36,py2} django111-py{34,35,36,py2}
django110-py{27,34,35,py2}
django19-py{27,34,35,py2}
django18-py{34,35,py2}
# ... then prereleases (if available): # ... then prereleases (if available):
django21-py{35,36,37} django21-py{35,36,37}
djangoMaster-py{36,37} djangoMaster-py{36,37}
[testenv] [testenv]
deps = deps =
django18: django>=1.8,<1.9 django111: django~=1.11.0
django19: django>=1.9,<1.10 django20: django~=2.0.0
django110: django>=1.10,<1.11
django111: django>=1.11,<1.12
django20: django>=2.0,<2.1
django21: django>=2.1a1 django21: django>=2.1a1
djangoMaster: https://github.com/django/django/tarball/master djangoMaster: https://github.com/django/django/tarball/master
# testing dependencies (duplicates setup.py tests_require): # testing dependencies (duplicates setup.py tests_require):
@@ -91,9 +85,6 @@ python =
[travis:env] [travis:env]
DJANGO = DJANGO =
1.8: django18
1.9: django19
1.10: django110
1.11: django111 1.11: django111
2.0: django20 2.0: django20
2.1: django21 2.1: django21