diff --git a/.travis/unittest.sh b/.travis/unittest.sh index e42764368..6d7d6896c 100755 --- a/.travis/unittest.sh +++ b/.travis/unittest.sh @@ -15,7 +15,7 @@ unittest(){ if [ $? != 0 ]; then exit 1 fi - find . -name 'tests' -type d -print0 | \ + find . -path ./tools/venv -prune -false -o -name 'tests' -type d -print0 | \ xargs -0 -I{} -n1 bash -c \ 'python3 -m unittest discover -v -s {}' cd - > /dev/null @@ -24,6 +24,10 @@ unittest(){ trap 'abort' 0 set -e +pushd tools; make; popd +. tools/venv/bin/activate +pip3 install pytest + unittest . trap : 0 diff --git a/setup.sh b/setup.sh index 21d9c19ec..497749871 100644 --- a/setup.sh +++ b/setup.sh @@ -1,9 +1,8 @@ #! /usr/bin/env bash -if [ `id -u ` == 0 ]; then - SUDO= -else - SUDO='sudo' +SUDO='sudo' +if [ $(id -u) -eq 0 ]; then + SUDO='' fi if [ -e /etc/lsb-release ];then diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 000000000..ef721c2b8 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,13 @@ +PYTHON:= python3.7 +.PHONY: all clean + +all: virtualenv + +virtualenv: + test -d venv || virtualenv -p $(PYTHON) venv + touch venv/bin/activate + +clean: + rm -fr venv + find -iname "*.pyc" -delete +