From 00af6321ae1d610335e76617413eb693db565570 Mon Sep 17 00:00:00 2001 From: Nicola Larosa Date: Thu, 6 Jul 2017 11:27:32 +0200 Subject: [PATCH] Allow running just one lwaftr test file (#859) Allow running just one lwaftr test file * Add quotes around arg in lwaftr selftest.sh --- src/program/lwaftr/tests/selftest.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/program/lwaftr/tests/selftest.sh b/src/program/lwaftr/tests/selftest.sh index 88af5b6ebb..44a09a28a8 100755 --- a/src/program/lwaftr/tests/selftest.sh +++ b/src/program/lwaftr/tests/selftest.sh @@ -6,18 +6,18 @@ export TESTS_DIR=`dirname "$0"` export PYTHONPATH=${TESTS_DIR} -# Only run tests in the passed subdirectory of $TESTS_DIR. -if [[ -n $1 ]]; then - START_DIR=${TESTS_DIR}/$1/ +# Only run tests in the chosen test file (without the _test.py suffix). +if [[ -n "$1" ]]; then + TEST_WHAT=$1 else - START_DIR=${TESTS_DIR} + TEST_WHAT="*" fi -# Start discovery from this script's directory, the root of the "tests" subtree, -# or one of its subdirectories, if passed as first argument to this script. -# Look for unittests in all files whose name ends with "_test.py". +# Start discovery from this script's directory, the root of the "tests" subtree. +# Look for unittests in all files whose name ends with "_test.py", or just one +# of them, if its prefix (without _test.py) was passed as first argument. # List all executed tests, don't show just dots. python3 -m unittest discover \ - --start-directory "${START_DIR}" \ - --pattern "*_test.py" \ + --start-directory "${TESTS_DIR}" \ + --pattern "${TEST_WHAT}_test.py" \ --verbose