summaryrefslogtreecommitdiff
path: root/tools/functional_tests.sh
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2015-12-29 16:42:18 +0100
committerGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2015-12-29 16:42:18 +0100
commitc580b1e69868e038ef61080aa6c6b92f112b4891 (patch)
tree48ece0e22c3fd5d65cadb5e6d4794b44e98c7973 /tools/functional_tests.sh
parent81b0a0679cc3adf93af22c4580b2f67c934b290e (diff)
downloadgitlab-c580b1e69868e038ef61080aa6c6b92f112b4891.tar.gz
functional_tests.sh: support python 2 and 3
Diffstat (limited to 'tools/functional_tests.sh')
-rwxr-xr-xtools/functional_tests.sh23
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/functional_tests.sh b/tools/functional_tests.sh
index 825d41f..6ea0b44 100755
--- a/tools/functional_tests.sh
+++ b/tools/functional_tests.sh
@@ -23,6 +23,25 @@ cleanup() {
}
trap cleanup EXIT
+PY_VER=2
+while getopts :p: opt "$@"; do
+ case $opt in
+ p)
+ PY_VER=$OPTARG;;
+ *)
+ echo "Unknown option: $opt"
+ exit 1;;
+ esac
+done
+
+case $PY_VER in
+ 2) VENV_CMD=virtualenv;;
+ 3) VENV_CMD=pyvenv;;
+ *)
+ echo "Wrong python version (2 or 3)"
+ exit 1;;
+esac
+
docker run --name gitlab-test --detach --publish 8080:80 --publish 2222:22 genezys/gitlab:latest >/dev/null 2>&1
LOGIN='root'
@@ -31,7 +50,7 @@ CONFIG=/tmp/python-gitlab.cfg
GITLAB="gitlab --config-file $CONFIG"
VENV=$(pwd)/.venv
-virtualenv $VENV
+$VENV_CMD $VENV
. $VENV/bin/activate
pip install -rrequirements.txt
pip install -e .
@@ -55,7 +74,7 @@ $OK
TOKEN=$(curl -s http://localhost:8080/api/v3/session \
-X POST \
--data "login=$LOGIN&password=$PASSWORD" \
- | python -c 'import sys, json; print json.load(sys.stdin)["private_token"]')
+ | python -c 'import sys, json; print(json.load(sys.stdin)["private_token"])')
cat > $CONFIG << EOF
[global]