forked from skyfielders/python-skyfield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-code.sh
executable file
·34 lines (29 loc) · 928 Bytes
/
test-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
#!/bin/bash
export PYTHONWARNINGS=d
cd "$(readlink -f $(dirname "${BASH_SOURCE[0]}"))"/ci
echo 'Changing to CI directory: cd' $(pwd)
set -e
if ! command -v assay >/dev/null
then
cat >&2 <<'EOF'
Error: "assay" command not found
Create a virtual environment and run "pip install -r requirements.txt"
to install all of the tools and libraries for Skyfield development.
EOF
exit 2
fi
r=$(git rev-parse --show-toplevel)
if grep ' $' \
$(git ls-files $r/design $r/examples $r/skyfield | grep '\.py$') \
/dev/null # prevent hanging on a grep of stdin if ls-files fails
then
echo
echo 'Error: trailing whitespace detected on the above-listed lines'
exit 1
fi
if python --version | grep -q 'Python 3' && command -v pyflakes >/dev/null
then
d=$(python -c 'import skyfield as s; print(s.__file__.rsplit("/", 1)[0])')
pyflakes $(find "$d" -name '*.py')
fi
exec assay --batch skyfield.tests