aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-06-06 14:05:55 +0800
committerfanquake <fanquake@gmail.com>2020-06-06 14:25:08 +0800
commit17cfa52d380673eaec3d428383b163ca4eb83f04 (patch)
treed2ca8e7e91a7a0c39440a9393a63aa5cd4940904
parent0fc6ea216c00fff470bd876c53418afca63bf7e9 (diff)
parent5d77549d8b287eb773db695b88c165ebe3be1005 (diff)
Merge #19172: test: Do not swallow flake8 exit code
5d77549d8b287eb773db695b88c165ebe3be1005 doc: Add mypy to test dependencies (Hennadii Stepanov) 7dda912e1c28b02723c9f24fa6c4e9003d928978 test: Do not swallow flake8 exit code (Hennadii Stepanov) Pull request description: After #18210 the `flake8` exit code in `test/lint/lint-python.sh` just not used that makes the linter broken. This PR: - combines exit codes of `flake8` and `mypy` into the `test/lint/lint-python.sh` exit code - documents `mypy` as the test dependency ACKs for top commit: MarcoFalke: Approach ACK 5d77549d8b287eb773db695b88c165ebe3be1005, fine with me practicalswift: ACK 5d77549d8b287eb773db695b88c165ebe3be1005 Tree-SHA512: e948ba04dc4d73393967ebf3c6a26c40d428d33766382a0310fc64746cb7972e027bd62e7ea76898b742a656cf7d0fcda2fdd61560a21bfd7be249cea27f3d41
-rw-r--r--test/README.md1
-rwxr-xr-xtest/lint/lint-python.sh14
2 files changed, 12 insertions, 3 deletions
diff --git a/test/README.md b/test/README.md
index 0210907878..b036a66f67 100644
--- a/test/README.md
+++ b/test/README.md
@@ -261,6 +261,7 @@ Use the `-v` option for verbose output.
| Lint test | Dependency | Version [used by CI](../ci/lint/04_install.sh) | Installation
|-----------|:----------:|:-------------------------------------------:|--------------
| [`lint-python.sh`](lint/lint-python.sh) | [flake8](https://gitlab.com/pycqa/flake8) | [3.7.8](https://github.com/bitcoin/bitcoin/pull/15257) | `pip3 install flake8==3.7.8`
+| [`lint-python.sh`](lint/lint-python.sh) | [mypy](https://github.com/python/mypy) | [0.700](https://github.com/bitcoin/bitcoin/pull/18210) | `pip3 install mypy==0.700`
| [`lint-shell.sh`](lint/lint-shell.sh) | [ShellCheck](https://github.com/koalaman/shellcheck) | [0.6.0](https://github.com/bitcoin/bitcoin/pull/15166) | [details...](https://github.com/koalaman/shellcheck#installing)
| [`lint-shell.sh`](lint/lint-shell.sh) | [yq](https://github.com/kislyuk/yq) | default | `pip3 install yq`
| [`lint-spelling.sh`](lint/lint-spelling.sh) | [codespell](https://github.com/codespell-project/codespell) | [1.15.0](https://github.com/bitcoin/bitcoin/pull/16186) | `pip3 install codespell==1.15.0`
diff --git a/test/lint/lint-python.sh b/test/lint/lint-python.sh
index b9aa6c799b..decea38c4f 100755
--- a/test/lint/lint-python.sh
+++ b/test/lint/lint-python.sh
@@ -90,12 +90,20 @@ elif PYTHONWARNINGS="ignore" flake8 --version | grep -q "Python 2"; then
exit 0
fi
-PYTHONWARNINGS="ignore" flake8 --ignore=B,C,E,F,I,N,W --select=$(IFS=","; echo "${enabled[*]}") $(
+EXIT_CODE=0
+
+if ! PYTHONWARNINGS="ignore" flake8 --ignore=B,C,E,F,I,N,W --select=$(IFS=","; echo "${enabled[*]}") $(
if [[ $# == 0 ]]; then
git ls-files "*.py"
else
echo "$@"
fi
-)
+); then
+ EXIT_CODE=1
+fi
+
+if ! mypy --ignore-missing-imports $(git ls-files "test/functional/*.py"); then
+ EXIT_CODE=1
+fi
-mypy --ignore-missing-imports $(git ls-files "test/functional/*.py") \ No newline at end of file
+exit $EXIT_CODE