-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestall.sh
executable file
·88 lines (79 loc) · 2.04 KB
/
testall.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
#!/usr/bin/env bash
# This script runs flake8 to test for pep8 compliance and executes all the examples and tests
# run as: testall.sh [-p COMMAND] [clean]
# Optional named arguments:
# -p COMMAND: the python command that should be used, e.g. ./testall.sh -p python3
#
# Default values
python="python"
# Check if a command line argument was provided as an input argument.
while getopts ":p:dh" opt; do
case $opt in
p)
python=$OPTARG
;;
d)
nodoc=TRUE
;;
h)
echo This runs all the tests and examples and checks for pep8 compliance
echo
echo Options:
echo ' -p COMMAND the python command that should be used to run the tests'
echo " -d don't execute the doc tests, they can take long"
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
# Run the examples and tests
python_version=$($python --version |& sed 's|Python \(.\).*|\1|g')
if [ "$python_version" = '3' ]; then
# Check code guidelines
echo -e '\e[32mChecking for code style errors \e[0m'
if ! flake8 easyfuse; then
exit 1
fi
fi
# if [ "$python_version" = '2' ]; then
# main_folder=python2_source
# cd $main_folder
# else
# main_folder=.
# fi
#
# echo -e '\e[32mTesting tests directory\e[0m'
# if ! $python $(which nosetests) tests/*; then
# exit 1
# fi
#
# if [ "$python_version" = '2' ]; then
# cd ..
# fi
#
# for f in $main_folder/examples/*.py; do
# echo -e '\e[32mTesting '$f'\e[0m'
# if ! $python $f; then
# exit 1
# fi
# done
#
# if [ "$clean" = 'TRUE' ]; then
# rm *.pdf *.log *.aux *.tex *.fls *.fdb_latexmk
# fi
if [ "$python_version" = '3' -a "$nodoc" != 'TRUE' ]; then
echo -e '\e[32mChecking for errors in docs and docstrings\e[0m'
cd docs
./create_doc_files.sh -p $python
make clean
if ! $python $(which sphinx-build) -b html -d _build/doctrees/ . _build/html -nW; then
exit 1
fi
fi