tox.ini: add a getmagic.sh to use Debian version of python-magic

Passerelle is developped on the Debian python-magic package which is extracted
from libmagic but does not exist on pypi, it makes testing those part of
passerelle from a virtualenv a bit difficult.
This commit is contained in:
Benjamin Dauvergne 2016-03-10 09:41:29 +01:00
parent 6d3f24333b
commit 1a88910fed
2 changed files with 21 additions and 3 deletions

18
getmagic.sh Executable file
View File

@ -0,0 +1,18 @@
#!/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/magic.py
# Link
ln -sv $SRCDIR/magic.py $DSTDIR
exit 0

View File

@ -3,12 +3,9 @@ envlist = django17,django18
[testenv]
usedevelop = True
sitepackages = True
setenv =
DJANGO_SETTINGS_MODULE=passerelle.settings
PASSERELLE_SETTINGS_FILE=tests/settings.py
commands =
py.test --junitxml=test_results.xml --cov-report xml --cov=passerelle/ --cov-config .coveragerc tests/
deps =
django17: django>1.7,<1.8
django18: django>=1.8,<1.9
@ -27,3 +24,6 @@ deps =
astroid==1.3.2
django-jsonresponse
gadjo
commands =
./getmagic.sh
py.test --junitxml=test_results.xml --cov-report xml --cov=passerelle/ --cov-config .coveragerc tests/