summaryrefslogtreecommitdiff
path: root/run_tests.sh
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@chmouel.com>2012-05-21 12:52:12 +0200
committerChmouel Boudjnah <chmouel@chmouel.com>2012-05-21 12:52:55 +0200
commiteb775a46ed907cc427303a9ad46e778eeb9c3784 (patch)
tree7e515e909284b9d9357132c71ba5b463ef6dccbf /run_tests.sh
parentdeff7eca1c5f2192eaf1b95aa5d03bab42f99576 (diff)
downloadpython-swiftclient-eb775a46ed907cc427303a9ad46e778eeb9c3784.tar.gz
Add run_tests.sh script here.
- Snatched from python-glanceclient repo.
Diffstat (limited to 'run_tests.sh')
-rwxr-xr-xrun_tests.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/run_tests.sh b/run_tests.sh
new file mode 100755
index 0000000..39ce191
--- /dev/null
+++ b/run_tests.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+function usage {
+ echo "Usage: $0 [OPTION]..."
+ echo "Run python-swiftclient's test suite(s)"
+ echo ""
+ echo " -p, --pep8 Just run pep8"
+ echo " -h, --help Print this usage message"
+ echo ""
+ echo "This script is deprecated and currently retained for compatibility."
+ echo 'You can run the full test suite for multiple environments by running "tox".'
+ echo 'You can run tests for only python 2.7 by running "tox -e py27", or run only'
+ echo 'the pep8 tests with "tox -e pep8".'
+ exit
+}
+
+command -v tox > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo 'This script requires "tox" to run.'
+ echo 'You can install it with "pip install tox".'
+ exit 1;
+fi
+
+just_pep8=0
+
+function process_option {
+ case "$1" in
+ -h|--help) usage;;
+ -p|--pep8) let just_pep8=1;;
+ esac
+}
+
+for arg in "$@"; do
+ process_option $arg
+done
+
+if [ $just_pep8 -eq 1 ]; then
+ tox -e pep8
+ exit
+fi
+
+tox -e py27 $toxargs 2>&1 | tee run_tests.err.log || exit
+if [ ${PIPESTATUS[0]} -ne 0 ]; then
+ exit ${PIPESTATUS[0]}
+fi
+
+if [ -z "$toxargs" ]; then
+ tox -e pep8
+fi