use tox for running tests

This commit is contained in:
Benjamin Dauvergne 2015-12-17 11:23:20 +01:00
parent f5e7e7d828
commit 073b66873e
3 changed files with 103 additions and 17 deletions

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

@ -3,26 +3,11 @@
rm -f *coverage.xml
rm -f *test_results.xml
export PIP_USE_WHEEL=no
pip install --upgrade setuptools
pip install --upgrade pip
pip install --upgrade pylint==1.4.0 astroid==1.3.2 # 1.4.1 is buggy
pip install --upgrade pytest pytest-django pytest-cov pytest-mock
pip install --upgrade django-tenant-schemas
pip install --upgrade -r requirements.txt
pip install --upgrade mock
pip install --upgrade raven
pip install http://git.entrouvert.org/authentic.git/snapshot/authentic-master.tar.gz
pip install --upgrade tox
DJANGO_SETTINGS_MODULE=hobo.settings \
HOBO_SETTINGS_FILE=tests/settings.py \
py.test --junitxml=hobo_server_test_results.xml --cov-report xml --cov=hobo/ --cov-config .coveragerc tests/
mv coverage.xml hobo_server_coverage.xml
PYTHONPATH=tests_multitenant DJANGO_SETTINGS_MODULE=settings py.test --junitxml=multitenant_test_results.xml --cov-report xml --cov=../hobo/ --cov-config .coveragerc tests_multitenant/
mv coverage.xml multitenant_coverage.xml
DEBIAN_CONFIG_COMMON=debian/debian_config_common.py DJANGO_SETTINGS_MODULE=authentic2.settings AUTHENTIC2_SETTINGS_FILE=tests_authentic/settings.py py.test --junitxml=authentic2_agent_test_results.xml --cov-report xml --cov=hobo/ --cov-config .coveragerc --nomigration tests_authentic/
mv coverage.xml authentic2_agent_coverage.xml
tox
./merge-junit-results.py hobo_server_test_results.xml multitenant_test_results.xml authentic2_agent_test_results.xml >test_results.xml
./merge-coverage.py -o coverage.xml *_coverage.xml

81
tox.ini Normal file
View File

@ -0,0 +1,81 @@
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[testenv:hobo]
# django.contrib.auth is not tested it does not work with our templates
whitelist_externals = /bin/mv
setenv =
DJANGO_SETTINGS_MODULE=hobo.settings
HOBO_SETTINGS_FILE=tests/settings.py
usedevelop = True
commands =
./getlasso.sh
py.test --junitxml=hobo_server_test_results.xml --cov-report xml --cov=hobo/ --cov-config .coveragerc tests/
mv coverage.xml hobo_server_coverage.xml
deps = django>1.7,<1.8
coverage
pytest
pytest-cov
pytest-django
pytest-mock
mock
raven
cssselect
pylint==1.4.0
astroid==1.3.2
WebTest
[testenv:hobo-multitenant]
# django.contrib.auth is not tested it does not work with our templates
whitelist_externals = /bin/mv
setenv =
PYTHONPATH=tests_multitenant
DJANGO_SETTINGS_MODULE=settings
commands =
./getlasso.sh
py.test --junitxml=multitenant_test_results.xml --cov-report xml --cov=../hobo/ --cov-config .coveragerc tests_multitenant/
mv coverage.xml multitenant_coverage.xml
usedevelop = True
deps = django>1.7,<1.8
coverage
pytest
pytest-cov
pytest-django
pytest-mock
mock
raven
cssselect
pylint==1.4.0
astroid==1.3.2
WebTest
[testenv:hobo-agent-authentic2]
# django.contrib.auth is not tested it does not work with our templates
whitelist_externals =
/bin/mv
pip
setenv =
DEBIAN_CONFIG_COMMON=debian/debian_config_common.py
DJANGO_SETTINGS_MODULE=authentic2.settings
AUTHENTIC2_SETTINGS_FILE=tests_authentic/settings.py
commands =
./getlasso.sh
pip install http://git.entrouvert.org/authentic.git/snapshot/authentic-master.tar.gz
py.test --junitxml=authentic2_agent_test_results.xml --cov-report xml --cov=hobo/ --cov-config .coveragerc --nomigration tests_authentic/
mv coverage.xml authentic2_agent_coverage.xml
usedevelop = True
deps = django>1.7,<1.8
coverage
pytest
pytest-cov
pytest-django
pytest-mock
mock
raven
cssselect
pylint==1.4.0
astroid==1.3.2
WebTest