Skip to content

Commit 17cfa52

Browse files
committed
Merge #19172: test: Do not swallow flake8 exit code
5d77549 doc: Add mypy to test dependencies (Hennadii Stepanov) 7dda912 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 5d77549, fine with me practicalswift: ACK 5d77549 Tree-SHA512: e948ba04dc4d73393967ebf3c6a26c40d428d33766382a0310fc64746cb7972e027bd62e7ea76898b742a656cf7d0fcda2fdd61560a21bfd7be249cea27f3d41
2 parents 0fc6ea2 + 5d77549 commit 17cfa52

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

test/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ Use the `-v` option for verbose output.
261261
| Lint test | Dependency | Version [used by CI](../ci/lint/04_install.sh) | Installation
262262
|-----------|:----------:|:-------------------------------------------:|--------------
263263
| [`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`
264+
| [`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`
264265
| [`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)
265266
| [`lint-shell.sh`](lint/lint-shell.sh) | [yq](https://github.com/kislyuk/yq) | default | `pip3 install yq`
266267
| [`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`

test/lint/lint-python.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,20 @@ elif PYTHONWARNINGS="ignore" flake8 --version | grep -q "Python 2"; then
9090
exit 0
9191
fi
9292

93-
PYTHONWARNINGS="ignore" flake8 --ignore=B,C,E,F,I,N,W --select=$(IFS=","; echo "${enabled[*]}") $(
93+
EXIT_CODE=0
94+
95+
if ! PYTHONWARNINGS="ignore" flake8 --ignore=B,C,E,F,I,N,W --select=$(IFS=","; echo "${enabled[*]}") $(
9496
if [[ $# == 0 ]]; then
9597
git ls-files "*.py"
9698
else
9799
echo "$@"
98100
fi
99-
)
101+
); then
102+
EXIT_CODE=1
103+
fi
104+
105+
if ! mypy --ignore-missing-imports $(git ls-files "test/functional/*.py"); then
106+
EXIT_CODE=1
107+
fi
100108

101-
mypy --ignore-missing-imports $(git ls-files "test/functional/*.py")
109+
exit $EXIT_CODE

0 commit comments

Comments
 (0)