Test Django 1.10

Also includes:
* Change AnymailTestMixin.assertDoesNotWarn
  to filter specific warning classes.
* Look specifically for AnymailInsecureWebhookWarning
  in WebhookBasicAuthTestsMixin.test_warns_if_no_auth
  (because we don't care *in that test case* about
  DeprecatedInDjango10 warnings).
This commit is contained in:
medmunds
2016-05-29 17:34:51 -07:00
parent 995617a130
commit 296f6cab50
4 changed files with 12 additions and 19 deletions

View File

@@ -2,20 +2,6 @@ sudo: false
language: python
matrix:
include:
## Django 1.4: Python 2.6--2.7 (but Anymail doesn't support 2.6)
#- { env: DJANGO=django==1.4, python: 2.7 }
## Django 1.5: Python 2.7, pypy
#- { env: DJANGO=django==1.5, python: 2.7 }
#- { env: DJANGO=django==1.5, python: pypy }
## Django 1.6: Python 2.7--3.3, pypy
#- { env: DJANGO=django==1.6, python: 2.7 }
#- { env: DJANGO=django==1.6, python: 3.3 }
#- { env: DJANGO=django==1.6, python: pypy }
## Django 1.7: Python 2.7--3.4, pypy
#- { env: DJANGO=django==1.7, python: 2.7 }
#- { env: DJANGO=django==1.7, python: 3.3 }
#- { env: DJANGO=django==1.7, python: 3.4 }
#- { env: DJANGO=django==1.7, python: pypy }
# Django 1.8: "Python 2.7 or above"
- { env: DJANGO=django==1.8, python: 2.7 }
- { env: DJANGO=django==1.8, python: 3.4 }
@@ -26,7 +12,8 @@ matrix:
- { env: DJANGO=django==1.9, python: 3.5 }
- { env: DJANGO=django==1.9, python: pypy }
# Django 1.10 (prerelease)
#- { env: DJANGO="--pre django", python: 3.5 }
- { env: DJANGO="--pre django", python: 2.7 }
- { env: DJANGO="--pre django", python: 3.5 }
cache:
directories:
- $HOME/.cache/pip

View File

@@ -49,7 +49,7 @@ Support is also planned for:
* Normalized inbound email processing through your ESP
Anymail is released under the BSD license. It is extensively tested against Django 1.8--1.9
Anymail is released under the BSD license. It is extensively tested against Django 1.8--1.10
(including Python 2.7, Python 3 and PyPy).
Anymail releases follow `semantic versioning <http://semver.org/>`_.

View File

@@ -51,9 +51,15 @@ class AnymailTestMixin:
return _AssertWarnsContext(expected_warning, self, expected_regex=expected_regex, msg=msg)
@contextmanager
def assertDoesNotWarn(self):
def assertDoesNotWarn(self, disallowed_warning=Warning):
"""Makes test error (rather than fail) if disallowed_warning occurs.
Note: you probably want to be more specific than the default
disallowed_warning=Warning, which errors for any warning
(including DeprecationWarnings).
"""
try:
warnings.simplefilter("error")
warnings.simplefilter("error", disallowed_warning)
yield
finally:
warnings.resetwarnings()

View File

@@ -82,7 +82,7 @@ class WebhookBasicAuthTestsMixin(object):
with self.assertWarns(AnymailInsecureWebhookWarning):
response = self.call_webhook()
else:
with self.assertDoesNotWarn():
with self.assertDoesNotWarn(AnymailInsecureWebhookWarning):
response = self.call_webhook()
self.assertEqual(response.status_code, 200)