From a441dc88c0a4665430d430b9e6857f5ee5314088 Mon Sep 17 00:00:00 2001 From: Colin Stubbs <3059577+colin-stubbs@users.noreply.github.com> Date: Wed, 7 Aug 2024 04:12:34 +1000 Subject: [PATCH] Add ability to test individual or a subset of modules only --- bbot/test/run_tests.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bbot/test/run_tests.sh b/bbot/test/run_tests.sh index 0b20a7056..3490f5b65 100755 --- a/bbot/test/run_tests.sh +++ b/bbot/test/run_tests.sh @@ -13,5 +13,13 @@ echo "=======================" flake8 --select F,E722 --ignore F403,F405,F541 --per-file-ignores="*/__init__.py:F401,F403" "$bbot_dir" || exit 1 echo -echo "[+] Testing with pytest" -pytest --exitfirst --disable-warnings --log-cli-level=ERROR "$bbot_dir" --cov=bbot/test/test_step_2/test_cli.py --cov-report="term-missing" --cov-config="$bbot_dir/test/coverage.cfg" +if [ "${1}x" != "x" ] ; then + MODULES=`echo ${1} | sed -e 's/,/ /g'` + for MODULE in ${MODULES} ; do + echo "[+] Testing ${MODULE} with pytest" + pytest --exitfirst --disable-warnings --log-cli-level=ERROR "$bbot_dir" --cov=bbot/test/test_step_2/test_cli.py --cov-report="term-missing" --cov-config="$bbot_dir/test/coverage.cfg" -k ${MODULE} + done +else + echo "[+] Testing all modules with pytest" + pytest --exitfirst --disable-warnings --log-cli-level=ERROR "$bbot_dir" --cov=bbot/test/test_step_2/test_cli.py --cov-report="term-missing" --cov-config="$bbot_dir/test/coverage.cfg" +fi