[enh] "./ynh-dev test" to deploy, update and run unit test stuff (#24)

* Adding ./ynh-dev test to deploy, update and run unit test stuff
* Fixing typo
* [fix] tests: use backcotes on python package check condition.
This commit is contained in:
Alexandre Aubin 2017-04-07 16:21:18 +02:00 committed by GitHub
parent 571ddbb81b
commit 686f11cf23

48
ynh-dev
View file

@ -19,6 +19,8 @@ Usage :
Upgrade the container
`basename $0` use-git [PACKAGES [PACKAGES ...]]
Use Git repositories from dev environment path
`basename $0` test [PACKAGES [PACKAGES ...]]
Deploy, update and run tests for some packages
`basename $0` self-update
Update this script (`basename $0`)
@ -306,6 +308,52 @@ elif [ "$1" = "use-git" ]; then
done
elif [ "$1" = "test" ]; then
check_yunohost_vm
VERSION=$2
for i in ${!packages[@]}; do
case ${packages[i]} in
yunohost)
# Pytest and tests dependencies
if ! type "pytest" > /dev/null; then
echo "======================="
echo "> Installing pytest ..."
echo "======================="
apt-get install python-pip
pip2 install pytest
fi
PIP_DEPENDENCIES="pytest-mock requests-mock"
for DEP in $PIP_DEPENDENCIES
do
if [ -z `pip show $DEP` ]; then
echo "======================="
echo "Installing $DEP with pip"
echo "======================="
pip2 install $DEP
fi
done
# Apps for test
cd /vagrant/yunohost/src/yunohost/tests
if [ ! -d "apps" ]; then
git clone https://github.com/YunoHost/test_apps ./apps
else
cd apps
git pull > /dev/null 2>&1
fi
# Run tests
echo "Running tests for YunoHost"
cd /vagrant/yunohost/
py.test tests
cd /vagrant/yunohost/src/yunohost
py.test tests
;;
esac
done
elif [ "$1" = "self-update" ]; then
check_yunohost_vm
cd /vagrant/vagrant && git pull origin master