diff --git a/.travis.yml b/.travis.yml index 1e4b574f..49ab122d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,37 +1,50 @@ language: python services: sqlite -env: - - DJANGO='django>=1.5,<1.6' - - DJANGO='django>=1.6,<1.7' - - DJANGO='django>=1.7,<1.8' - - DJANGO='django>=1.8,<1.9' - - DJANGO='django>=1.9,<1.10' -python: - - 3.5 - - 3.4 - - 3.3 - - 3.2 - - 2.7 -install: - - pip install $DJANGO - - python setup.py install - - pip install factory_boy mock pytest-django -script: py.test tests/ +cache: + directories: + - $HOME/.cache/pip +before_cache: + - rm -f $HOME/.cache/pip/log/debug.log matrix: - exclude: - - python: 3.2 - env: DJANGO='django>=1.8,<1.9' - - python: 3.2 - env: DJANGO='django>=1.9,<1.10' - - python: 3.3 - env: DJANGO='django>=1.8,<1.9' - - python: 3.3 - env: DJANGO='django>=1.9,<1.10' - - python: 3.4 - env: DJANGO='django>=1.4,<1.5' - - python: 3.5 - env: DJANGO='django>=1.5,<1.6' - - python: 3.5 - env: DJANGO='django>=1.6,<1.7' - - python: 3.5 - env: DJANGO='django>=1.7,<1.8' \ No newline at end of file + include: + - python: 2.7 + env: TOX_ENV=py27-django15 + - python: 2.7 + env: TOX_ENV=py27-django16 + - python: 2.7 + env: TOX_ENV=py27-django17 + - python: 2.7 + env: TOX_ENV=py27-django18 + - python: 3.3 + env: TOX_ENV=py33-django15 + - python: 3.3 + env: TOX_ENV=py33-django16 + - python: 3.3 + env: TOX_ENV=py33-django17 + - python: 3.3 + env: TOX_ENV=py33-django18 + - python: 3.4 + env: TOX_ENV=py34-django15 + - python: 3.4 + env: TOX_ENV=py34-django16 + - python: 3.4 + env: TOX_ENV=py34-django17 + - python: 3.4 + env: TOX_ENV=py34-django18 + - python: 3.4 + env: TOX_ENV=py34-django19 + - python: 3.4 + env: TOX_ENV=py34-django110 + - python: 3.5 + env: TOX_ENV=py35-django18 + - python: 3.5 + env: TOX_ENV=py35-django19 + - python: 3.5 + env: TOX_ENV=py35-django110 + + +script: tox -e $TOX_ENV + +install: + - pip install pip setuptools wheel -U + - pip install tox diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 9a8a7126..5a1a7dd8 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -29,6 +29,7 @@ Direct Contributors * Lacey Williams Henschel * Gregory Shikhman * Mike Bryant +* Fabio C. Barrionuevo da Luz Other Contributors ================== diff --git a/docs/contributing.rst b/docs/contributing.rst index 7b35fa80..3d8d4a91 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -42,7 +42,7 @@ Tests ----- All code changes should come with test changes. We use -`py.test `_ instead of Python's +`py.test `_ instead of Python's ``unittest``. This seems to only be really important when marking tests for skipping. @@ -50,4 +50,4 @@ We try to keep the project at 100% test coverage but know this isn't something we can achieve forever. So long as your tests cover your contribution 80% or better, we're happy to try and bump up that last bit, or just accept the code. -We currently test Braces against late (usually latest) versions of Python 2.6, 2.7, 3.2, 3.3, and 3.4. We also test against the latest released version of Django from 1.5 to 1.8. +We currently test Braces against late (usually latest) versions of Python 2.7, 3.2, 3.3, 3.4 and 3.5. We also test against the latest released version of Django from 1.5 to 1.10. diff --git a/setup.py b/setup.py index 9a49f6b9..215de6da 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,6 @@ "Development Status :: 5 - Production/Stable", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", @@ -32,6 +31,7 @@ "Framework :: Django :: 1.6", "Framework :: Django :: 1.7", "Framework :: Django :: 1.8", - "Framework :: Django :: 1.9" + "Framework :: Django :: 1.9", + "Framework :: Django :: 1.10" ], ) diff --git a/tests/compat.py b/tests/compat.py index ed5417df..a44e4d9e 100644 --- a/tests/compat.py +++ b/tests/compat.py @@ -9,6 +9,22 @@ from django.utils import simplejson as json try: - from django.conf.urls import patterns, url, include + from django.conf.urls import url, include except ImportError: - from django.conf.urls.defaults import patterns, url, include + from django.conf.urls.defaults import url, include + + +def patterns_compat(urlpatterns): + try: + from django.conf.urls import patterns + except ImportError: + try: + from django.conf.urls.defaults import patterns + except ImportError: + patterns = False + if patterns: + return patterns( + '', *urlpatterns + ) + else: + return urlpatterns diff --git a/tests/settings.py b/tests/settings.py index 90da66f4..dc3743fc 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -29,16 +29,6 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -TEMPLATE_CONTEXT_PROCESSORS = [ - 'django.contrib.auth.context_processors.auth', - 'django.core.context_processors.i18n', - 'django.core.context_processors.media', - 'django.core.context_processors.static', - 'django.core.context_processors.tz', - 'django.core.context_processors.request', - 'django.contrib.messages.context_processors.messages' -] - STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', @@ -60,6 +50,40 @@ ) import django + +if django.VERSION >= (1, 10): + 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.template.context_processors.i18n', + 'django.template.context_processors.media', + 'django.template.context_processors.static', + 'django.template.context_processors.tz', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, + ] + AUTH_PASSWORD_VALIDATORS = [] + +else: + TEMPLATE_CONTEXT_PROCESSORS = [ + 'django.contrib.auth.context_processors.auth', + 'django.core.context_processors.i18n', + 'django.core.context_processors.media', + 'django.core.context_processors.static', + 'django.core.context_processors.tz', + 'django.core.context_processors.request', + 'django.contrib.messages.context_processors.messages' + ] + if django.VERSION < (1, 4): TEMPLATE_CONTEXT_PROCESSORS.remove('django.core.context_processors.tz') MIDDLEWARE_CLASSES.remove( diff --git a/tests/urls.py b/tests/urls.py index 8a4b1291..734fe996 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,11 +1,10 @@ from __future__ import absolute_import +from django.contrib.auth.views import login from . import views -from .compat import patterns, include, url +from .compat import include, url, patterns_compat - -urlpatterns = patterns( - '', +urlpatterns = [ # LoginRequiredMixin tests url(r'^login_required/$', views.LoginRequiredView.as_view()), @@ -110,12 +109,11 @@ # RecentLoginRequiredMixin tests url(r'^recent_login/$', views.RecentLoginRequiredView.as_view()), url(r'^outdated_login/$', views.RecentLoginRequiredView.as_view()), -) +] +urlpatterns += [ + url(r'^accounts/login/$', login, {'template_name': 'blank.html'}), + url(r'^auth/login/$', login, {'template_name': 'blank.html'}), +] -urlpatterns += patterns( - 'django.contrib.auth.views', - # login page, required by some tests - url(r'^accounts/login/$', 'login', {'template_name': 'blank.html'}), - url(r'^auth/login/$', 'login', {'template_name': 'blank.html'}), -) +urlpatterns = patterns_compat(urlpatterns) diff --git a/tests/urls_namespaced.py b/tests/urls_namespaced.py index 20920be5..177e0151 100644 --- a/tests/urls_namespaced.py +++ b/tests/urls_namespaced.py @@ -1,13 +1,13 @@ from __future__ import absolute_import from . import views -from .compat import patterns, url +from .compat import url, patterns_compat - -urlpatterns = patterns( - '', +urlpatterns = [ # CanonicalSlugDetailMixin namespace tests url(r'^article/(?P\d+)-(?P[\w-]+)/$', views.CanonicalSlugDetailView.as_view(), name="namespaced_article"), -) +] + +urlpatterns = patterns_compat(urlpatterns) diff --git a/tox.ini b/tox.ini index 41b3356e..62e63762 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,10 @@ [tox] -envlist = py{27,32,33,34}-django{15,16,17,18},py{27,34,35}-django{18,19} +envlist = py{27,33,34}-django{15,16,17,18},py{34,35}-django{18,19,110} install_command = pip install {opts} {packages} [testenv] basepython = py27: python2.7 - py32: python3.2 py33: python3.3 py34: python3.4 py35: python3.5 @@ -17,9 +16,9 @@ commands = deps = mock - pytest-django factory_boy - py32: coverage==3.7 + py{27,33,34}: pytest-django==2.9.1 + py{35}: pytest-django>2.9.1 py{27,33,34,35}: coverage==4.1 argparse django15: Django>=1.5,<1.6 @@ -27,3 +26,4 @@ deps = django17: Django>=1.7,<1.8 django18: Django>=1.8,<1.9 django19: Django>=1.9,<1.10 + django110: Django>=1.10,<1.11