| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
if [ $# -lt 1 ] |
| 6 |
then |
| 7 |
$0 coverage |
| 8 |
$0 typecheck |
| 9 |
$0 qa |
| 10 |
exit 0 |
| 11 |
fi |
| 12 |
|
| 13 |
root=$(readlink -f "$(dirname "$0")") |
| 14 |
|
| 15 |
# print deprecation warnings etc. |
| 16 |
export PYTHONDEVMODE=1 |
| 17 |
|
| 18 |
# ignore known warnings from third party libraries |
| 19 |
export PYTHONWARNINGS='default,ignore:::itypes' |
| 20 |
|
| 21 |
SUBCMD=$1 |
| 22 |
shift 1 |
| 23 |
|
| 24 |
case $SUBCMD in |
| 25 |
"tests") |
| 26 |
cd "$root" |
| 27 |
python -m unittest tests/*.py $@ |
| 28 |
cd - |
| 29 |
;; |
| 30 |
"coverage") |
| 31 |
cd "$root" |
| 32 |
python3-coverage run -m unittest tests/*.py |
| 33 |
python3-coverage report |
| 34 |
cd - |
| 35 |
;; |
| 36 |
"quick") |
| 37 |
cd "$root" |
| 38 |
ftp_proxy=http://invalid.org python -m unittest tests/*.py $@ |
| 39 |
cd - |
| 40 |
;; |
| 41 |
"qa") |
| 42 |
cd "$root" |
| 43 |
flake8 confusable_homoglyphs |
| 44 |
isort --check-only --diff confusable_homoglyphs |
| 45 |
if which doc8 |
| 46 |
then |
| 47 |
doc8 docs |
| 48 |
fi |
| 49 |
cd - |
| 50 |
;; |
| 51 |
"typecheck") |
| 52 |
cd "$root" |
| 53 |
mypy . |
| 54 |
cd - |
| 55 |
;; |
| 56 |
"static") |
| 57 |
cd "$root" |
| 58 |
bandit --recursive --number=3 -lll -iii . |
| 59 |
cd - |
| 60 |
;; |
| 61 |
*) |
| 62 |
echo "No such subcommand $SUBCMD" |
| 63 |
;; |
| 64 |
esac |