-
Notifications
You must be signed in to change notification settings - Fork 174
/
run-tests.sh
executable file
·59 lines (43 loc) · 1.16 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
#!/bin/sh
OUTPUT_PATH=`pwd`/tests_output
log()
{
echo "$@" | tee -a $OUTPUT_PATH/test.log
}
nosetest_yanc_plugin()
{
nosetests --plugins | grep yanc >/dev/null
}
rm -rf $OUTPUT_PATH
mkdir -p $OUTPUT_PATH
NOSETEST_OPTIONS="-d"
if [ -n "$VERBOSE" ]; then
NOSETEST_OPTIONS="$NOSETEST_OPTIONS --verbose"
fi
if [ -z "$NOCOLOR" ] && nosetest_yanc_plugin; 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 --with-coverage --cover-min-percentage=100 --cover-package=rauth"
fi
nosetest_yanc_plugin || [ -n "$NOCOLOR" ] || log "No yanc plugin for nosetests found. Color output unavailable."
log "Running tests..."
if [ $BASH ]; then
nosetests $NOSETEST_OPTIONS 2>&1 | tee -a $OUTPUT_PATH/test.log
R=${PIPESTATUS[0]}
else
4>&1 R=$({ { nosetests $NOSETEST_OPTIONS 2>&1; echo $? >&3 ; } | { tee -a $OUTPUT_PATH/test.log >&4; } } 3>&1)
fi
echo
nosetests -V
python -V
case "$R" in
0) log "SUCCESS" ;;
*) log "FAILURE" ;;
esac
exit $R