]> git.scottworley.com Git - pinch/blob - test.sh
81e0c667a707478cee8b4ae55a4f6f98a700459a
[pinch] / test.sh
1 #!/bin/sh
2
3 set -e
4
5 PARALLELISM=4
6
7 find . -name build -prune -o -name dist -prune -o -name '*.py' -print0 |
8 xargs -0 mypy --strict --ignore-missing-imports --no-warn-unused-ignores
9
10 for test in tests/*;do
11 if [ ! -d "$test" ];then
12 echo "### Running test $test" >&2
13 "$test"
14 fi
15 done
16
17 find . -name '*_test.py' -print0 | xargs -0 -r -n1 python3
18
19 if [ "$1" = lint ];then
20
21 find . -name '*.py' -print0 | xargs -0 pylint --reports=n --persistent=n --ignore-imports=y -d fixme,invalid-name,missing-docstring,subprocess-run-check,too-few-public-methods
22
23 formatting_needs_fixing=$(
24 find . -name '*.py' -print0 |
25 xargs -P "$PARALLELISM" -0 -n1 autopep8 --diff -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
26 )
27 if [[ "$formatting_needs_fixing" ]];then
28 echo "Formatting needs fixing:"
29 echo "$formatting_needs_fixing"
30 exit 1
31 fi
32
33 fi