-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathrun-tests.sh
executable file
·100 lines (87 loc) · 2.47 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
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env sh
# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# quit on errors:
set -o errexit
# quit on unbound symbols:
set -o nounset
USAGE=$(cat <<-END
Usage:
run-tests.sh [-s | --styles] [-d | --docs] [-t | --tests]
run-tests.sh -h | --help
Options:
-h, --help Show this screen.
-s, --styles check styles
-d, --docs build and test docs
-t, --tests run unit tests
END
)
check_styles(){
pydocstyle renku tests conftest.py docs
black --check --diff renku tests conftest.py
isort -c --df .
flake8 renku/ tests/ conftest.py
find . -path ./.eggs -prune -o -iname \*.sh -print0 | xargs -0 shellcheck
poetry lock --no-update && (git diff --exit-code -- poetry.lock > /dev/null || (echo "Poetry lock file out of date! Run 'poetry lock'"))
}
build_docs(){
sphinx-build -qnNW docs docs/_build/html
sphinx-build -nNW -b spelling -d docs/_build/doctrees docs docs/_build/spelling
pytest --black --flake8 -v -m "not integration and not publish" -o testpaths="docs conftest.py" --ignore=docs/conf.py
}
run_tests(){
pytest -v -m "not integration and not publish and not redis" -o testpaths="tests renku conftest.py" --ignore=renku/version.py
}
usage(){
echo "$USAGE"
}
all=1
tests=
docs=
styles=
while [ "${1-}" != "" ]; do
case $1 in
-t | --tests )
tests=1
all=0
;;
-d | --docs )
docs=1
all=0
;;
-s | --styles )
styles=1
all=0
;;
-h | --help )
usage
exit
;;
esac
shift
done
docs=$((docs||all))
tests=$((tests||all))
styles=$((styles||all))
if [ "$docs" = "1" ]; then
build_docs
fi
if [ "$styles" = "1" ]; then
check_styles
fi
if [ "$tests" = "1" ]; then
run_tests
fi