From c30cbde5333f909ed95f96aa7684443b389df989 Mon Sep 17 00:00:00 2001 From: David Fischer Date: Mon, 16 Jan 2017 21:30:39 -0800 Subject: [PATCH] Test Django 1.10 --- .travis.yml | 12 +++++------- README.rst | 4 ++-- docs/setup.txt | 4 ++-- runtravis.py | 34 ++++++++++++++++++++++++++++++++++ runtravis.sh | 10 ---------- 5 files changed, 43 insertions(+), 21 deletions(-) create mode 100755 runtravis.py delete mode 100644 runtravis.sh diff --git a/.travis.yml b/.travis.yml index e92c19d..1875f3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,16 +8,14 @@ python: - "3.5" env: - - DJANGO="Django<1.9" - - DJANGO="Django<1.10" + - DJANGO_VERSION="Django<1.9" + - DJANGO_VERSION="Django<1.10" + - DJANGO_VERSION="Django<1.11" install: - - pip install -q $DJANGO + - pip install -q $DJANGO_VERSION - pip install flake8 -before_script: - - chmod +x runtravis.sh - script: - flake8 --ignore=E501,W391 rpc4django - - ./runtravis.sh + - ./runtravis.py diff --git a/README.rst b/README.rst index 94a08ac..20bae5e 100644 --- a/README.rst +++ b/README.rst @@ -8,8 +8,8 @@ RPC4Django Prerequisites ------------- -- Python_ 2.6, 2.7, 3.3 -- Django_ 1.4+ +- Python_ 2.7, 3.3+ +- Django_ 1.8+ - DefusedXML_ - Docutils_ (optional) diff --git a/docs/setup.txt b/docs/setup.txt index f9ed373..98c0b7a 100644 --- a/docs/setup.txt +++ b/docs/setup.txt @@ -6,8 +6,8 @@ Prerequisites RPC4Django has been tested on Mac OS, Linux and Windows. -- Python_ 2.6, 2.7, 3.3 -- Django_ 1.4+ +- Python_ 2.7, 3.3+ +- Django_ 1.8+ - DefusedXML_ - Docutils_ (optional) diff --git a/runtravis.py b/runtravis.py new file mode 100755 index 0000000..99552c3 --- /dev/null +++ b/runtravis.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import os +import subprocess +import sys + +# Handle incompatible versions of Python & Django +# https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django +SUPPORTED_VERSIONS = { + '2.7': ('Django<1.9', 'Django<1.10', 'Django<1.11'), + '3.3': ('Django<1.9',), + '3.4': ('Django<1.9', 'Django<1.10', 'Django<1.11'), + '3.5': ('Django<1.9', 'Django<1.10', 'Django<1.11'), +} + +python_version = os.environ.get('TRAVIS_PYTHON_VERSION') +django_version = os.environ.get('DJANGO_VERSION') + +if not python_version: + sys.exit(u'Unknown python version: {}'.format(python_version)) +if not django_version: + sys.exit(u'Unknown django version: {}'.format(django_version)) + +if python_version in SUPPORTED_VERSIONS: + # If the version of Django is not supported with this version of + # Python simply exit the tests with a success + if django_version not in SUPPORTED_VERSIONS[python_version]: + print(u'Incompatible Python/Django versions - ignoring') + else: + p = subprocess.Popen(['python', 'setup.py', 'test']) + p.communicate() + sys.exit(p.returncode) +else: + sys.exit(u'Unsupported python version: {}'.format(python_version)) diff --git a/runtravis.sh b/runtravis.sh deleted file mode 100644 index 850e64f..0000000 --- a/runtravis.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -ev - -# Handle incompatible versions of Python & Django -if ([ $TRAVIS_PYTHON_VERSION == '3.3' ] && [ $DJANGO == 'Django<1.10' ]) -then - exit 0 -else - python setup.py test -fi