mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
Merge pull request #46 from alexAubin/select-tests
Be able to selects which tests to run
This commit is contained in:
commit
09457ad9dd
1 changed files with 23 additions and 6 deletions
29
ynh-dev
29
ynh-dev
|
@ -17,6 +17,8 @@ function show_usage() {
|
||||||
ip Give the ip of the guest container
|
ip Give the ip of the guest container
|
||||||
use-git [PKG] Use Git repositories from dev environment path
|
use-git [PKG] Use Git repositories from dev environment path
|
||||||
test [PKG] Deploy, update and run tests for some packages
|
test [PKG] Deploy, update and run tests for some packages
|
||||||
|
Tests for single modules and functions can ran with
|
||||||
|
e.g. ./ynh-dev test yunohost/appurl:urlavailable
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
@ -270,10 +272,14 @@ function run_tests()
|
||||||
local PACKAGES="$@"
|
local PACKAGES="$@"
|
||||||
for PACKAGE in "$PACKAGES";
|
for PACKAGE in "$PACKAGES";
|
||||||
do
|
do
|
||||||
|
TEST_FUNCTION=$(echo "$PACKAGE" | tr '/:' ' ' | awk '{print $3}')
|
||||||
|
TEST_MODULE=$(echo "$PACKAGE" | tr '/:' ' ' | awk '{print $2}')
|
||||||
|
PACKAGE=$(echo "$PACKAGE" | tr '/:' ' ' | awk '{print $1}')
|
||||||
|
|
||||||
case $PACKAGE in
|
case $PACKAGE in
|
||||||
yunohost)
|
yunohost)
|
||||||
# Pytest and tests dependencies
|
# Pytest and tests dependencies
|
||||||
if ! type "pytest" > /dev/null; then
|
if ! type "pytest" > /dev/null 2>&1; then
|
||||||
info "> Installing pytest ..."
|
info "> Installing pytest ..."
|
||||||
apt-get install python-pip -y
|
apt-get install python-pip -y
|
||||||
pip2 install pytest
|
pip2 install pytest
|
||||||
|
@ -293,12 +299,23 @@ function run_tests()
|
||||||
git pull > /dev/null 2>&1
|
git pull > /dev/null 2>&1
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
info "Running tests for YunoHost ..."
|
info "Running tests for YunoHost"
|
||||||
[ -e "/etc/yunohost/installed" ] || critical "You should run postinstallation before running tests :s."
|
[ -e "/etc/yunohost/installed" ] || critical "You should run postinstallation before running tests :s."
|
||||||
cd /ynh-dev/yunohost/
|
if [[ -z "$TEST_MODULE" ]]
|
||||||
py.test tests
|
then
|
||||||
cd /ynh-dev/yunohost/src/yunohost
|
cd /ynh-dev/yunohost/
|
||||||
py.test tests
|
py.test tests
|
||||||
|
cd /ynh-dev/yunohost/src/yunohost
|
||||||
|
py.test tests
|
||||||
|
else
|
||||||
|
cd /ynh-dev/yunohost/src/yunohost
|
||||||
|
if [[ -z "$TEST_FUNCTION" ]]
|
||||||
|
then
|
||||||
|
py.test tests/test_"$TEST_MODULE".py
|
||||||
|
else
|
||||||
|
py.test tests/test_"$TEST_MODULE".py::test_"$TEST_FUNCTION"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue