forked from deanishe/alfred-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.sh
executable file
·89 lines (65 loc) · 2.18 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# Copied from flask-login
# https://github.com/maxcountryman/flask-login
# OUTPUT_PATH=$(pwd)/tests_output
rootdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# workflow="${rootdir}/workflow"
logpath="${rootdir}/test.log"
# testroot="/tmp/alfred-wörkflöw-$$"
# testdir="${testroot}/tests"
# curdir=$(pwd)
function log() {
echo "$@" | tee -a $logpath
}
# Delete old log file if it exists
if [[ -f "${logpath}" ]]; then
rm -rf "${logpath}"
fi
# ###############################################################################
# # Set up test environment
# ###############################################################################
# if [[ -d "${testroot}" ]]; then
# rm -rf "${testroot}"
# fi
# mkdir -p "${testroot}"
# cp -R "${rootdir}/tests" "${testdir}"
# ln -s "${rootdir}/workflow" "${testdir}/workflow"
# ln -s "${rootdir}/tests/info.plist.test" "${testroot}/info.plist"
# cd "${testdir}"
# cd "${rootdir}"
###############################################################################
# Set test options and run tests
###############################################################################
NOSETEST_OPTIONS="-d"
if [ -n "$VERBOSE" ]; then
NOSETEST_OPTIONS="$NOSETEST_OPTIONS --verbose"
fi
if [ -z "$NOCOLOR" ]; then
NOSETEST_OPTIONS="$NOSETEST_OPTIONS --with-yanc --yanc-color=on"
fi
if [ -n "$OPTIONS" ]; then
NOSETEST_OPTIONS="$NOSETEST_OPTIONS $OPTIONS"
fi
if [ -n "$TESTS" ]; then
NOSETEST_OPTIONS="$NOSETEST_OPTIONS $TESTS"
else
NOSETEST_OPTIONS="$NOSETEST_OPTIONS -v --with-coverage --cover-min-percentage=100 --cover-package=workflow --logging-clear-handlers"
fi
# PYTEST_OPTS="--cov-report term-missing --cov workflow --capture=fd"
log "Running tests..."
nosetests $NOSETEST_OPTIONS 2>&1 | tee -a $logpath
# py.test $PYTEST_OPTS 2>&1 | tee -a $logpath
ret=${PIPESTATUS[0]}
echo
case "$ret" in
0) log -e "SUCCESS" ;;
*) log -e "FAILURE" ;;
esac
###############################################################################
# Delete test environment
###############################################################################
# cd "$curdir"
# if [[ -d "${testroot}" ]]; then
# rm -rf "${testroot}"
# fi
exit $ret