Skip to content

Commit 19ec078

Browse files
committed
oops, test for conftest.py instead of the directory
1 parent 61a8bc5 commit 19ec078

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

ynh-dev

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,15 @@ function run_tests()
553553
fi
554554
done
555555

556+
# ./src/tests is being moved to ./tests, this small patch supports both paths
557+
if [[ -e "/ynh-dev/yunohost/tests/conftest.py" ]]; then
558+
tests_parentdir=/ynh-dev/yunohost
559+
else
560+
tests_parentdir=/ynh-dev/yunohost/src
561+
fi
562+
556563
# Apps for test
557-
cd /ynh-dev/yunohost/src/tests
564+
cd "$tests_parentdir/tests"
558565
[ -d "apps" ] || git clone https://github.com/YunoHost/test_apps ./apps
559566
cd apps
560567
git pull > /dev/null 2>&1
@@ -563,20 +570,14 @@ function run_tests()
563570
info "Running tests for YunoHost"
564571
[ -e "/etc/yunohost/installed" ] || critical "You should run postinstallation before running tests :s."
565572

566-
# ./src/tests is being moved to ./tests, this small patch supports both paths
567-
if [[ -e "/ynh-dev/yunohost/src/tests" ]]; then
568-
cd /ynh-dev/yunohost/src
569-
else
570-
cd /ynh-dev/yunohost
571-
fi
572-
573573
testpath=tests
574574
if [[ -n "$TEST_MODULE" ]]; then
575575
testpath="${testpath}/test_${TEST_MODULE}.py"
576576
if [[ -n "$TEST_FUNCTION" ]]; then
577577
testpath="${testpath}::test_${TEST_FUNCTION}"
578578
fi
579579
fi
580+
cd "$tests_parentdir"
580581
pytest "$testpath"
581582
;;
582583
esac

0 commit comments

Comments
 (0)