Skip to content

Commit

Permalink
added ability to run tests against different python version
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Obrist committed Jan 7, 2011
1 parent 21c984e commit 6d1b599
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ index=0
reuse_env=true
disable_coverage=true
django_trunk=false
python=`python -c "import sys; print '.'.join([str(x) for x in sys.version_info[:2]])"`

while [ "$index" -lt "$num_args" ]
do
Expand All @@ -27,6 +28,11 @@ do
"--django-trunk")
django_trunk=true
;;

"--python")
let "index = $index + 1"
python="${args[$index]}"
;;

"--help")
echo ""
Expand All @@ -40,6 +46,7 @@ do
echo " --with-coverage - enables coverage"
echo " --rebuild-env - run buildout before the tests"
echo " --django-trunk - run tests against django trunk"
echo " --python X.X - python version to use to run the tests"
exit 1
;;

Expand All @@ -50,6 +57,11 @@ do
done

current_buildout_django=`cat .installed.cfg | grep "^version = " | sed s/'version = '//`
current_buildout_python=`head -n 1 bin/buildout | sed s/[^0-9\.]//g`

python_path="/usr/bin/python$python"

echo "using python $python"

if [ $reuse_env == true ]; then
if [[ $django_trunk == true && $current_buildout_django != 'trunk' ]]; then
Expand All @@ -58,12 +70,15 @@ if [ $reuse_env == true ]; then
if [[ $django_trunk == false && $current_buildout_django != '1.2.4' ]]; then
reuse_env=false
fi
fi
fi
if [[ $python != $current_buildout_python ]]; then
reuse_env=false
fi
fi

if [ $reuse_env == false ]; then
echo "setting up test environment (this might take a while)..."
python bootstrap.py
$python_path bootstrap.py
if [ $? != 0 ]; then
echo "bootstrap.py failed"
exit 1
Expand Down

0 comments on commit 6d1b599

Please sign in to comment.