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
|
||||
use-git [PKG] Use Git repositories from dev environment path
|
||||
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
|
||||
}
|
||||
|
@ -270,10 +272,14 @@ function run_tests()
|
|||
local PACKAGES="$@"
|
||||
for PACKAGE in "$PACKAGES";
|
||||
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
|
||||
yunohost)
|
||||
# Pytest and tests dependencies
|
||||
if ! type "pytest" > /dev/null; then
|
||||
if ! type "pytest" > /dev/null 2>&1; then
|
||||
info "> Installing pytest ..."
|
||||
apt-get install python-pip -y
|
||||
pip2 install pytest
|
||||
|
@ -293,12 +299,23 @@ function run_tests()
|
|||
git pull > /dev/null 2>&1
|
||||
|
||||
# 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."
|
||||
cd /ynh-dev/yunohost/
|
||||
py.test tests
|
||||
cd /ynh-dev/yunohost/src/yunohost
|
||||
py.test tests
|
||||
if [[ -z "$TEST_MODULE" ]]
|
||||
then
|
||||
cd /ynh-dev/yunohost/
|
||||
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
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue