mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
[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:
parent
571ddbb81b
commit
686f11cf23
1 changed files with 48 additions and 0 deletions
48
ynh-dev
48
ynh-dev
|
@ -19,6 +19,8 @@ Usage :
|
||||||
Upgrade the container
|
Upgrade the container
|
||||||
`basename $0` use-git [PACKAGES [PACKAGES ...]]
|
`basename $0` use-git [PACKAGES [PACKAGES ...]]
|
||||||
Use Git repositories from dev environment path
|
Use Git repositories from dev environment path
|
||||||
|
`basename $0` test [PACKAGES [PACKAGES ...]]
|
||||||
|
Deploy, update and run tests for some packages
|
||||||
`basename $0` self-update
|
`basename $0` self-update
|
||||||
Update this script (`basename $0`)
|
Update this script (`basename $0`)
|
||||||
|
|
||||||
|
@ -306,6 +308,52 @@ elif [ "$1" = "use-git" ]; then
|
||||||
done
|
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
|
elif [ "$1" = "self-update" ]; then
|
||||||
check_yunohost_vm
|
check_yunohost_vm
|
||||||
cd /vagrant/vagrant && git pull origin master
|
cd /vagrant/vagrant && git pull origin master
|
||||||
|
|
Loading…
Reference in a new issue