Skip to content

Commit

Permalink
Merge pull request #15 from caktus/update_supported_versions
Browse files Browse the repository at this point in the history
Support Django 1.11 and Python 3.6, drop some older python versions
  • Loading branch information
dpoirier authored Nov 1, 2017
2 parents ee19b9b + 576b449 commit 978a0b9
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 33 deletions.
49 changes: 38 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,50 @@
# Use travis container-based build system for speed
sudo: false

# Ubuntu trusty (14.04) - latest that Travis offers
dist: trusty

# Make sure all the python versions we need are pre-installed
# (apt-get is not available in the container-based build system)
addons:
apt:
sources:
- deadsnakes
packages:
- python2.7
- python3.4
- python3.5
- python3.6

language: python

# The version of Python that'll be used to invoke tox. Has no effect
# on what version of Python tox uses to run each set of tests.
python:
- "3.5"

# Test a sampling of combinations
env:
- TOXENV=py26-1.5,py27-1.5,py33-1.5
- TOXENV=py26-1.6,py27-1.6,py33-1.6
- TOXENV=py27-1.7,py33-1.7,py34-1.7
- TOXENV=py27-1.8,py33-1.8,py34-1.8
- TOXENV=py27-1.9,py34-1.9,py35-1.9
- TOXENV=py27-1.10,py34-1.10,py35-1.10
- TOXENV=py27-trunk,py34-trunk,py35-trunk
- TOXENV=py27-1.7
- TOXENV=py27-1.8
- TOXENV=py27-1.10
- TOXENV=py27-1.11
- TOXENV=py34-1.7
- TOXENV=py34-1.8
- TOXENV=py34-1.11
- TOXENV=py35-1.9
- TOXENV=py35-1.10
- TOXENV=py35-1.11
- TOXENV=py36-1.8
- TOXENV=py36-1.10
- TOXENV=py36-1.11

install:
- pip install tox

script:
- tox

matrix:
allow_failures:
- env: TOXENV=py27-trunk,py33-trunk
#
#matrix:
# allow_failures:
# - env: TOXENV=py27-trunk,py33-trunk
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ email backend such as `django-ses <https://github.com/hmarr/django-ses>`_.
Requirements
-------------------------------

- Python 2.6, 2.7 or 3.3+ (Python 3 support required Django >= 1.5)
- Django >= 1.3
- Python 2.7 or 3.5+
- Django >= 1.8 (supported versions)


Installation
Expand Down
2 changes: 1 addition & 1 deletion bandit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'major': 1,
'minor': 3,
'micro': 0,
'releaselevel': 'dev',
'releaselevel': 'final',
}


Expand Down
12 changes: 9 additions & 3 deletions bandit/tests.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from __future__ import unicode_literals
import six

import asyncore
import platform
import smtpd
import threading
from email import message_from_string
try:
if six.PY3:
# Python 3
from email.utils import parseaddr
except ImportError:
else:
# Python 2
from email.Utils import parseaddr

Expand All @@ -26,13 +28,17 @@ class FakeSMTPServer(smtpd.SMTPServer, threading.Thread):

def __init__(self, *args, **kwargs):
threading.Thread.__init__(self)
if platform.python_version_tuple() >= ("3", "5"):
kwargs.setdefault('decode_data', True)
smtpd.SMTPServer.__init__(self, *args, **kwargs)
self._sink = []
self.active = False
self.active_lock = threading.Lock()
self.sink_lock = threading.Lock()

def process_message(self, peer, mailfrom, rcpttos, data):
def process_message(self, peer, mailfrom, rcpttos, data, **kwargs):
# if not isinstance(data, six.text_type):
# data = data.decode('utf-8')
m = message_from_string(data)
maddr = parseaddr(m.get('from'))[1]
if mailfrom != maddr:
Expand Down
8 changes: 5 additions & 3 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ to a ``DeprecationWarning`` and the following release the feature and it's relat
code will be removed.


v1.3.dev (Not yet released)
-------------------------------
v1.3 (released 2017-10-31)
--------------------------

- <Add changes here>
- Added support and test coverage for Django 1.11
- Added support and test coverage for Python 3.6
- Dropped support for Python 2.6 and Python 3.3.


v1.2 (Released 2016-11-08)
Expand Down
2 changes: 1 addition & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def runtests():
django.setup()
from django.test.utils import get_runner
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=True, failfast=False)
test_runner = TestRunner(verbosity=1, interactive=True, failfast=True)
failures = test_runner.run_tests(['bandit', ])
sys.exit(failures)

Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def read_file(filename):
url='https://github.com/caktus/django-email-bandit',
license='BSD',
description=' '.join(__import__('bandit').__doc__.splitlines()).strip(),
install_requires=[
'six'
],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
Expand All @@ -32,9 +35,8 @@ def read_file(filename):
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
],
Expand Down
16 changes: 6 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
[tox]
envlist = py26-{1.5,1.6},
{py27,py33}-{1.5,1.6},
{py27,py33,py34}-{1.7,1.8},
{py27,py34,py35}-{1.9,1.10,trunk},
envlist = py27-{1.5,1.6},
{py27,py34}-{1.7,1.8},
{py27,py35,py36}-{1.8,1.9,1.10,1.11},
docs

[testenv]
commands = {envpython} runtests.py
commands = {envpython} -Wmodule runtests.py
basepython =
py26: python2.6
py27: python2.7
py33: python3.3
py34: python3.4
py35: python3.5
py36: python3.6
deps =
1.3: Django>=1.3,<1.4
1.4: Django>=1.4,<1.5
1.5: Django>=1.5,<1.6
1.6: Django>=1.6,<1.7
1.7: Django>=1.7,<1.8
1.8: Django>=1.8,<1.9
1.9: Django>=1.9,<1.10
1.10: Django>=1.10,<1.11
trunk: https://github.com/django/django/archive/master.tar.gz
1.11: Django>=1.11,<2.0

[testenv:docs]
basepython = python3.4
Expand Down

0 comments on commit 978a0b9

Please sign in to comment.