-
Notifications
You must be signed in to change notification settings - Fork 4
/
run-test
executable file
·34 lines (33 loc) · 1.48 KB
/
run-test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
#=======================================================================
# FILE: run-tests.sh
# DESCRIPTION: Runs test suite under all supported versions of Python
# and displays failures when encountered.
#=======================================================================
#-----------------------------------------------------------------------
# Define function (takes command to run as a single argument).
#-----------------------------------------------------------------------
run_command ()
{
echo "" >&2
echo "======================================================================" >&2
echo "$1" >&2
echo "======================================================================" >&2
$1 # <- Run command.
if [ $? -ne 0 ] # Check exit status of completed command.
then
echo "" >&2
echo "Failed Command: $1" >&2
echo "" >&2
exit $? # <- EXIT!
fi
}
[[ "$(command -v coverage)" ]] || { echo "Sorry! Command (coverage) is not installed...." 1>&2 && exit -1; }
#-----------------------------------------------------------------------
# Run test suite in all supported versions of Python.
#-----------------------------------------------------------------------
run_command "python3 -B -m unittest $*"
#run_command coverage run --source . -m unittest discover && coverage report
#run_command coverage run --source . -m unittest discover && coverage html
echo "" >&2
echo "All commands successful." >&2