forked from python-trio/trio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.sh
executable file
·51 lines (40 loc) · 1.48 KB
/
check.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
#!/bin/bash
set -ex
EXIT_STATUS=0
# Test if the generated code is still up to date
python ./trio/_tools/gen_exports.py --test \
|| EXIT_STATUS=$?
# Autoformatter *first*, to avoid double-reporting errors
# (we'd like to run further autoformatters but *after* merging;
# see https://forum.bors.tech/t/pre-test-and-pre-merge-hooks/322)
# autoflake --recursive --in-place .
# pyupgrade --py3-plus $(find . -name "*.py")
if ! black --check setup.py trio; then
EXIT_STATUS=1
black --diff setup.py trio
fi
# Run flake8 without pycodestyle and import-related errors
flake8 trio/ \
--ignore=D,E,W,F401,F403,F405,F821,F822\
|| EXIT_STATUS=$?
# Run mypy on all supported platforms
mypy -m trio -m trio.testing --platform linux || EXIT_STATUS=$?
mypy -m trio -m trio.testing --platform darwin || EXIT_STATUS=$? # tests FreeBSD too
mypy -m trio -m trio.testing --platform win32 || EXIT_STATUS=$?
# Finally, leave a really clear warning of any issues and exit
if [ $EXIT_STATUS -ne 0 ]; then
cat <<EOF
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Problems were found by static analysis (listed above).
To fix formatting and see remaining errors, run
pip install -r test-requirements.txt
black setup.py trio
./check.sh
in your local checkout.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
EOF
exit 1
fi
exit 0