The code using 'python-escalatorclient' as the client's package name. But the true...
[escalator.git] / client / run_tests.sh
1 #!/bin/bash
2
3 function usage {
4   echo "Usage: $0 [OPTION]..."
5   echo "Run escalatorclient's test suite(s)"
6   echo ""
7   echo "  -p, --pep8               Just run flake8"
8   echo "  -h, --help               Print this usage message"
9   echo ""
10   echo "This script is deprecated and currently retained for compatibility."
11   echo 'You can run the full test suite for multiple environments by running "tox".'
12   echo 'You can run tests for only python 2.7 by running "tox -e py27", or run only'
13   echo 'the flake8 tests with "tox -e pep8".'
14   exit
15 }
16
17 command -v tox > /dev/null 2>&1
18 if [ $? -ne 0 ]; then
19   echo 'This script requires "tox" to run.'
20   echo 'You can install it with "pip install tox".'
21   exit 1; 
22 fi
23
24 just_pep8=0
25
26 function process_option {
27   case "$1" in
28     -h|--help) usage;;
29     -p|--pep8) let just_pep8=1;;
30   esac
31 }
32
33 for arg in "$@"; do
34   process_option $arg
35 done
36
37 if [ $just_pep8 -eq 1 ]; then
38   tox -e pep8
39   exit
40 fi
41
42 tox -e py27 $toxargs 2>&1 | tee run_tests.err.log  || exit
43 if [ ${PIPESTATUS[0]} -ne 0 ]; then
44   exit ${PIPESTATUS[0]}
45 fi
46
47 if [ -z "$toxargs" ]; then
48   tox -e pep8
49 fi