-
Notifications
You must be signed in to change notification settings - Fork 177
/
check-code.sh
executable file
·47 lines (39 loc) · 980 Bytes
/
check-code.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
#!/usr/bin/env bash
# Convenience script for running CI-like checks.
set -eu
set -x
if [ "${1:-}" == "--with-docker" ]; then
shift
# Do `docker run -ti` only if running on a TTY
if [ -t 0 ]; then
ti="-ti"
else
ti=""
fi
exec docker run $ti \
-e SKIP_STYLE_CHECK="${SKIP_STYLE_CHECK:-no}" \
-v $(pwd):/code \
opendatacube/datacube-tests:latest \
$0 $@
fi
if [ "${SKIP_STYLE_CHECK:-no}" != "yes" ]; then
pycodestyle tests integration_tests examples --max-line-length 120
pylint -j 2 --reports no datacube
fi
# Run tests, taking coverage.
# Users can specify extra folders as arguments.
pytest -r a \
--cov datacube \
--doctest-ignore-import-errors \
--durations=5 \
datacube \
tests \
$@
set +x
# Optionally validate example yaml docs.
if which yamllint;
then
set -x
yamllint $(find . \( -iname '*.yaml' -o -iname '*.yml' \) )
set +x
fi