Skip to content

Commit

Permalink
Allow running just one lwaftr test file (snabbco#859)
Browse files Browse the repository at this point in the history
Allow running just one lwaftr test file

* Add quotes around arg in lwaftr selftest.sh
  • Loading branch information
teknico authored Jul 6, 2017
1 parent cc1c0eb commit 00af632
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/program/lwaftr/tests/selftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 00af632

Please sign in to comment.