add tox.ini to test on django 1.7, 1.8, 1.9 and with sqlite and pg

This commit is contained in:
Benjamin Dauvergne 2016-02-12 19:42:48 +01:00
parent 3ca64e7eaf
commit f2cf86f7a6
4 changed files with 62 additions and 2 deletions

2
.coveragerc Normal file
View File

@ -0,0 +1,2 @@
[run]
omit = tests/*

20
getlasso.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# Get venv site-packages path
DSTDIR=`python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'`
# Get not venv site-packages path
# Remove first path (assuming that is the venv path)
NONPATH=`echo $PATH | sed 's/^[^:]*://'`
SRCDIR=`PATH=$NONPATH python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'`
# Clean up
rm -f $DSTDIR/lasso.*
rm -f $DSTDIR/_lasso.*
# Link
ln -sv $SRCDIR/lasso.py $DSTDIR
ln -sv $SRCDIR/_lasso.* $DSTDIR
exit 0

View File

@ -1,11 +1,12 @@
import os
from django.conf import global_settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'ENGINE': 'django.db.backends.' + os.environ.get('DB_ENGINE', 'sqlite3'),
'NAME': 'mellon.sqlite3',
'TEST': {
'NAME': 'mellon-test.sqlite',
'NAME': 'mellon-test-' + os.environ.get('DB_ENGINE', 'sqlite3'),
},
}
}
@ -13,3 +14,4 @@ DEBUG = True
SECRET_KEY='xx'
INSTALLED_APPS = ('mellon', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions')
MIDDLEWARE_CLASSES = global_settings.MIDDLEWARE_CLASSES
ROOT_URLCONF = 'mellon.urls'

36
tox.ini Normal file
View File

@ -0,0 +1,36 @@
[tox]
envlist = {coverage-,}{dj17,dj18,dj19}-{pg,sqlite}
[testenv]
whitelist_externals =
/bin/mv
setenv =
DJANGO_SETTINGS_MODULE=testsettings
PYTHONPATH=.
sqlite: DB_ENGINE=sqlite3
pg: DB_ENGINE=postgresql_psycopg2
coverage: COVERAGE=--junit-xml=junit-{envname}.xml --cov=mellon --cov-report xml
usedevelop =
coverage: true
nocoverage: false
deps =
dj17: django>1.7,<1.8
dj18: django>1.8,<1.9
dj19: django>1.9,<1.10
pg: psycopg2
httmock
pytest
pytest-cov
pytest-random
pytest-mock
pytest-django
pytest-capturelog
lxml
cssselect
django-webtest
WebTest
pyquery
commands =
./getlasso.sh
py.test --random {env:COVERAGE:} {posargs:tests}
coverage: mv coverage.xml coverage-{envname}.xml