Adds a tox file and uses it in Travis CI.

This commit is contained in:
Bertrand Bordage 2014-11-28 22:12:03 +01:00
parent bd8facfff7
commit 1f08dada56
2 changed files with 34 additions and 45 deletions

View File

@ -1,58 +1,16 @@
language: python
python:
- 2.6
- 2.7
- 3.2
- 3.3
- 3.4
services:
- memcached
- redis-server
env:
- DJANGO=1.6.8
- DJANGO=1.7.1
install:
- pip install Django==$DJANGO psycopg2 django-redis South
coveralls
- if [[ $TRAVIS_PYTHON_VERSION == 3* ]];
then
pip install
python3-memcached
-e git+https://github.com/clelland/MySQL-for-Python-3#egg=MySQL-python;
else
pip install python-memcached MySQL-python unittest2;
fi
install: pip install tox coveralls
before_script:
- psql -c 'CREATE USER cachalot CREATEDB;' -U postgres
- psql -c 'CREATE DATABASE cachalot OWNER cachalot;' -U postgres
- mysql -u root -e 'CREATE DATABASE cachalot;'
script:
# Run against all database and cache backends, accumulating coverage stats.
- coverage run --source=cachalot ./runtests.py
- CACHE_BACKEND=redis coverage run --source=cachalot ./runtests.py
- CACHE_BACKEND=memcached coverage run --source=cachalot ./runtests.py
- DB_ENGINE=postgresql coverage run --source=cachalot ./runtests.py
- DB_ENGINE=postgresql CACHE_BACKEND=redis
coverage run --source=cachalot ./runtests.py
- DB_ENGINE=postgresql CACHE_BACKEND=memcached
coverage run --source=cachalot ./runtests.py
- DB_ENGINE=mysql coverage run --source=cachalot ./runtests.py
- DB_ENGINE=mysql CACHE_BACKEND=redis
coverage run --source=cachalot ./runtests.py
- DB_ENGINE=mysql CACHE_BACKEND=memcached
coverage run --source=cachalot ./runtests.py
script: tox
after_success:
- coveralls
matrix:
exclude:
# Django 1.7 is not compatible with Python 2.6
- python: 2.6
env: DJANGO=1.7.1
after_success: coveralls

31
tox.ini Normal file
View File

@ -0,0 +1,31 @@
[tox]
envlist =
py2.6-django1.6-{sqlite3,postgresql,mysql}-{locmem,redis,memcached},
py{2.7,3.2,3.3,3.4}-django{1.6,1.7}-{sqlite3,postgresql,mysql}-{locmem,redis,memcached},
[testenv]
basepython =
py2.6: python2.6
py2.7: python2.7
py3.2: python3.2
py3.3: python3.3
py3.4: python3.4
deps =
coverage
django1.6: Django>=1.6,<1.7
django1.7: Django>=1.7,<1.8
South
psycopg2
django-redis
py2.7: python-memcached
py2.7: MySQL-python
py3.4: python3-memcached
py3.4: https://github.com/clelland/MySQL-for-Python-3/tarball/master
setenv =
sqlite3: DB_ENGINE=sqlite3
postgresql: DB_ENGINE=postgresql
mysql: DB_ENGINE=mysql
locmem: CACHE_BACKEND=locmem
redis: CACHE_BACKEND=redis
memcached: CACHE_BACKEND=memcached
commands = coverage run --source=cachalot ./runtests.py