-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.sh
executable file
·56 lines (47 loc) · 1.02 KB
/
runtests.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
#!/bin/bash
# Project specific properties
export DJANGO_SETTINGS_MODULE=django_multi_factor_authentication.settings.test
feedback_loop(){
cmd=$*
if which inotifywait; then
while true; do
clear;
sh -c "$cmd";
echo "Waiting for file changes";
inotifywait --exclude='.*\.log' -qre modify *;
sleep 1;
done;
else
export LC_NUMERIC="en_US.UTF-8"
watch -c -n 0.1 -- "$cmd"
fi;
}
verbosity=0
parallel="--parallel"
while getopts "1h" opt; do
case $opt in
1) RUN_ONCE=1;;
h) usage;;
esac
done
shift $((OPTIND-1))
if [ -z "$VIRTUAL_ENV" ]; then
if [ -e "../bin/activate" ]; then
echo "Activating your environment for you"
. ../bin/activate
else
echo "Please activate your environment first!"
exit 1
fi
fi
FAKETIME_ENV=$(python-libfaketime)
cmd="
set -e
eval ${FAKETIME_ENV}
python manage.py test $parallel --verbosity=$verbosity $*
echo"
if [ -z $RUN_ONCE ]; then
feedback_loop "$cmd"
else
sh -c "$cmd"
fi