-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrun_tests.sh
executable file
·66 lines (57 loc) · 1.28 KB
/
run_tests.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
BASE_DIR=$(cd $(dirname "$0") && pwd -P)
cd $BASE_DIR
# UTILS
warning() {
echo "! $@" >&2
}
error() {
echo "$@" >&2
exit 2
}
clean_pyc() {
local retval
find . -name \*.pyc -print0 | xargs -0 rm -f
retval=$?
warning "Removed all *.pyc files from " >&2
return $?
}
usage() {
cat <<EOT
---------------------------
WaterMarker Tester
---------------------------
Runs unittests as well as integration testing
Usage:
full tests $0
file test $0 /path/test_file.py
module test $0 test.module
EOT
}
# Usage print
while getopts ":h" opt; do
case $opt in
h)
usage
exit 0
;;
esac
done
# CONSTANTS
PYTHON=$(which python) || error "Python 2.7 or later required"
NOSETESTS=$(which nosetests) || error "Nosetests not installed"
clean_pyc || error "Failed to cleanup pyc files"
$NOSETESTS \
--with-coverage \
--detailed-errors \
--logging-level=ERROR \
--cover-branches \
--cover-erase \
--cover-package=watermarker \
--cover-package=watermark.color \
--cover-package=watermark.constants \
--cover-package=watermark.job \
--cover-package=watermark.utils \
--cover-package=watermark.validator \
--cover-package=watermark.workflow \
"${@:1}"