Skip to content

Instantly share code, notes, and snippets.

@rshk
Created April 27, 2013 16:19
Show Gist options
  • Save rshk/5473646 to your computer and use it in GitHub Desktop.
Save rshk/5473646 to your computer and use it in GitHub Desktop.
Utility script to run Python unittests located in a ``tests`` package in the same directory
#!/bin/bash
ROOTDIR="$( dirname "$0" )"
cd "$ROOTDIR"
if [ $# == 0 ]; then
python -m unittest discover -v
else
if [ "$1" == "--list" ]; then
ls tests/test_*.py | sed 's#^tests/test_\(.*\)\.py$#\1#' | sort
exit
fi
for arg in "$@"; do
python -m unittest -v tests.test_"$arg"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment