mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
Be able to test specific functions
This commit is contained in:
parent
12dd30d36a
commit
19e7fae061
1 changed files with 11 additions and 7 deletions
16
ynh-dev
16
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,12 +272,9 @@ function run_tests()
|
||||||
local PACKAGES="$@"
|
local PACKAGES="$@"
|
||||||
for PACKAGE in "$PACKAGES";
|
for PACKAGE in "$PACKAGES";
|
||||||
do
|
do
|
||||||
local TEST_MODULE=""
|
TEST_FUNCTION=$(echo "$PACKAGE" | tr '/:' ' ' | awk '{print $3}')
|
||||||
if [[ "$PACKAGE" == *"/"* ]]
|
TEST_MODULE=$(echo "$PACKAGE" | tr '/:' ' ' | awk '{print $2}')
|
||||||
then
|
PACKAGE=$(echo "$PACKAGE" | tr '/:' ' ' | awk '{print $1}')
|
||||||
TEST_MODULE=$(echo "$PACKAGE" | awk -F'/' '{print $2}')
|
|
||||||
PACKAGE=$(echo "$PACKAGE" | awk -F'/' '{print $1}')
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $PACKAGE in
|
case $PACKAGE in
|
||||||
yunohost)
|
yunohost)
|
||||||
|
@ -310,7 +309,12 @@ function run_tests()
|
||||||
py.test tests
|
py.test tests
|
||||||
else
|
else
|
||||||
cd /ynh-dev/yunohost/src/yunohost
|
cd /ynh-dev/yunohost/src/yunohost
|
||||||
|
if [[ -z "$TEST_FUNCTION" ]]
|
||||||
|
then
|
||||||
py.test tests/test_"$TEST_MODULE".py
|
py.test tests/test_"$TEST_MODULE".py
|
||||||
|
else
|
||||||
|
py.test tests/test_"$TEST_MODULE".py::test_"$TEST_FUNCTION"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Add table
Reference in a new issue