Skip to content

Commit 61a8bc5

Browse files
committed
run_tests: support yunohost tests in src/tests and tests
1 parent 0203a52 commit 61a8bc5

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

ynh-dev

100755100644
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -562,21 +562,22 @@ function run_tests()
562562
# Run tests
563563
info "Running tests for YunoHost"
564564
[ -e "/etc/yunohost/installed" ] || critical "You should run postinstallation before running tests :s."
565-
if [[ -z "$TEST_MODULE" ]]
566-
then
567-
cd /ynh-dev/yunohost/
568-
py.test tests
565+
566+
# ./src/tests is being moved to ./tests, this small patch supports both paths
567+
if [[ -e "/ynh-dev/yunohost/src/tests" ]]; then
569568
cd /ynh-dev/yunohost/src
570-
py.test tests
571569
else
572-
cd /ynh-dev/yunohost/src
573-
if [[ -z "$TEST_FUNCTION" ]]
574-
then
575-
py.test tests/test_"$TEST_MODULE".py
576-
else
577-
py.test tests/test_"$TEST_MODULE".py::test_"$TEST_FUNCTION"
570+
cd /ynh-dev/yunohost
571+
fi
572+
573+
testpath=tests
574+
if [[ -n "$TEST_MODULE" ]]; then
575+
testpath="${testpath}/test_${TEST_MODULE}.py"
576+
if [[ -n "$TEST_FUNCTION" ]]; then
577+
testpath="${testpath}::test_${TEST_FUNCTION}"
578578
fi
579579
fi
580+
pytest "$testpath"
580581
;;
581582
esac
582583
done

0 commit comments

Comments
 (0)