From 296f6cab50c7fa0a20cb8a5417014699f83eb59e Mon Sep 17 00:00:00 2001 From: medmunds Date: Sun, 29 May 2016 17:34:51 -0700 Subject: [PATCH] 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). --- .travis.yml | 17 ++--------------- README.rst | 2 +- tests/utils.py | 10 ++++++++-- tests/webhook_cases.py | 2 +- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index b145cb0..cb497d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/README.rst b/README.rst index e7b101f..404ffb5 100644 --- a/README.rst +++ b/README.rst @@ -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 `_. diff --git a/tests/utils.py b/tests/utils.py index bd505d5..59054f5 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -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() diff --git a/tests/webhook_cases.py b/tests/webhook_cases.py index f8a2020..c40723e 100644 --- a/tests/webhook_cases.py +++ b/tests/webhook_cases.py @@ -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)