Skip to content

Commit

Permalink
test: Run mypy on Python scripts
Browse files Browse the repository at this point in the history
This covers e.g. src/client/cockpit-client or tools/urls-check, and also
some helpers in pkg, which are not executable files, but have a shebang.

https://issues.redhat.com/browse/COCKPIT-1038
  • Loading branch information
martinpitt authored and allisonkarlitskaya committed Nov 2, 2023
1 parent 4d97bf5 commit 0c634d1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/static-code
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ find_scripts() {
(
# Any non-binary file which contains a given shebang
git grep --cached -lIz '^#!.*'"$1"
# Any file ending in the provided regex
# Any file matching the provided glob
git ls-files -z "$2"
) | sort -z | uniq -z
}
Expand All @@ -50,6 +50,9 @@ if [ "${WITH_PARTIAL_TREE:-0}" = 0 ]; then
test -e "src/cockpit/_vendor/${pkg}/__init__.py" || skip "no ${pkg}"
done
mypy --no-error-summary src/cockpit test/pytest
# test scripts individually, to avoid clashing on `__main__`
# also skip integration tests, they are too big and not annotated
find_scripts 'python3' "*.none" | grep -zv 'test/' | xargs -r -0 -n1 mypy --no-error-summary
}

test_vulture() {
Expand Down

0 comments on commit 0c634d1

Please sign in to comment.