From 7b0cd76b2e2e36e41464f43e4b77e022238068db Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 12 Dec 2018 18:23:55 +0000 Subject: [PATCH] Be able to selects which tests to run --- ynh-dev | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/ynh-dev b/ynh-dev index db693be..1e92cef 100755 --- a/ynh-dev +++ b/ynh-dev @@ -270,10 +270,17 @@ function run_tests() local PACKAGES="$@" for PACKAGE in "$PACKAGES"; do + local TEST_MODULE="" + if [[ "$PACKAGE" == *"/"* ]] + then + TEST_MODULE=$(echo "$PACKAGE" | awk -F'/' '{print $2}') + PACKAGE=$(echo "$PACKAGE" | awk -F'/' '{print $1}') + fi + 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 @@ -294,10 +301,16 @@ function run_tests() # Run tests echo "Running tests for YunoHost" - 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 + py.test tests/test_"$TEST_MODULE".py + fi ;; esac done