forked from deadc0de6/dotdrop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.sh
executable file
·57 lines (49 loc) · 1.27 KB
/
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
#!/bin/sh
# author: deadc0de6 (https://github.com/deadc0de6)
# Copyright (c) 2017, deadc0de6
# stop on first error
set -ev
# PEP8 tests
which pycodestyle 2>/dev/null
[ "$?" != "0" ] && echo "Install pycodestyle" && exit 1
pycodestyle --ignore=W503,W504,W605 dotdrop/
pycodestyle tests/
pycodestyle scripts/
# pyflakes tests
pyflakes dotdrop/
pyflakes tests/
# retrieve the nosetests binary
set +e
nosebin="nosetests"
which ${nosebin} 2>/dev/null
[ "$?" != "0" ] && nosebin="nosetests3"
which ${nosebin} 2>/dev/null
[ "$?" != "0" ] && echo "Install nosetests" && exit 1
set -e
# do not print debugs when running tests (faster)
export DOTDROP_FORCE_NODEBUG=yes
# execute tests with coverage
PYTHONPATH=dotdrop ${nosebin} -s --with-coverage --cover-package=dotdrop
#PYTHONPATH=dotdrop python3 -m pytest tests
## execute bash script tests
[ "$1" = '--python-only' ] || {
log=`mktemp`
for scr in tests-ng/*.sh; do
${scr} > "${log}" 2>&1 &
tail --pid="$!" -f "${log}"
set +e
wait "$!"
if [ "$?" -ne 0 ]; then
echo "Test ${scr} finished with error"
rm -f ${log}
exit 1
elif grep Traceback ${log}; then
echo "crash found in logs"
rm -f ${log}
exit 1
fi
set -e
done
rm -f ${log}
}
echo "All test finished successfully"