diff --git a/.travis.yml b/.travis.yml index 233ea39..31c989b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/README.rst b/README.rst index 551e17c..a7188a3 100644 --- a/README.rst +++ b/README.rst @@ -29,8 +29,8 @@ email backend such as `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 diff --git a/bandit/__init__.py b/bandit/__init__.py index 68e11b2..d7ed8ec 100644 --- a/bandit/__init__.py +++ b/bandit/__init__.py @@ -6,7 +6,7 @@ 'major': 1, 'minor': 3, 'micro': 0, - 'releaselevel': 'dev', + 'releaselevel': 'final', } diff --git a/bandit/tests.py b/bandit/tests.py index f9f91aa..536a43a 100644 --- a/bandit/tests.py +++ b/bandit/tests.py @@ -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 @@ -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: diff --git a/docs/releases.rst b/docs/releases.rst index 386e999..d9c1ff8 100644 --- a/docs/releases.rst +++ b/docs/releases.rst @@ -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) +-------------------------- -- +- 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) diff --git a/runtests.py b/runtests.py index 2f20f8c..9b288d9 100644 --- a/runtests.py +++ b/runtests.py @@ -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) diff --git a/setup.py b/setup.py index ecf8155..c057b01 100644 --- a/setup.py +++ b/setup.py @@ -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', @@ -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', ], diff --git a/tox.ini b/tox.ini index 3a200db..6e8530b 100644 --- a/tox.ini +++ b/tox.ini @@ -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