Run Python checks from test-all.sh
The Python style enforcements are easy to miss otherwise.
This commit is contained in:
@@ -40,6 +40,9 @@ else
|
|||||||
echo "If a newer version of rustfmt is available, update this script."
|
echo "If a newer version of rustfmt is available, update this script."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
banner "Python checks"
|
||||||
|
$topdir/lib/cretonne/meta/check.sh
|
||||||
|
|
||||||
PKGS="cretonne cretonne-reader cretonne-tools filecheck"
|
PKGS="cretonne cretonne-reader cretonne-tools filecheck"
|
||||||
cd "$topdir"
|
cd "$topdir"
|
||||||
for PKG in $PKGS
|
for PKG in $PKGS
|
||||||
|
|||||||
@@ -4,29 +4,23 @@ cd $(dirname "$0")
|
|||||||
|
|
||||||
runif() {
|
runif() {
|
||||||
if command -v "$1" > /dev/null; then
|
if command -v "$1" > /dev/null; then
|
||||||
echo "=== $1 ==="
|
echo " === $1 ==="
|
||||||
"$@"
|
"$@"
|
||||||
else
|
else
|
||||||
echo "$1 not found"
|
echo "$1 not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check Python sources for Python 3 compatibility using pylint.
|
|
||||||
#
|
|
||||||
# Install pylint with 'pip install pylint'.
|
|
||||||
runif pylint --py3k --reports=no -- *.py cdsl base cretonne isa
|
|
||||||
|
|
||||||
# Style linting.
|
# Style linting.
|
||||||
runif flake8 .
|
runif flake8 .
|
||||||
|
|
||||||
# Type checking.
|
# Type checking.
|
||||||
runif mypy --py2 build.py
|
runif mypy --py2 build.py
|
||||||
|
|
||||||
echo "=== Python unit tests ==="
|
# Python unit tests.
|
||||||
python -m unittest discover
|
runif python -m unittest discover
|
||||||
|
|
||||||
# Then run the unit tests again with Python 3.
|
# Then run the unit tests again with Python 3.
|
||||||
# We get deprecation warnings about assertRaisesRegexp which was renamed in
|
# We get deprecation warnings about assertRaisesRegexp which was renamed in
|
||||||
# Python 3, but there doesn't seem to be an easy workaround.
|
# Python 3, but there doesn't seem to be an easy workaround.
|
||||||
runif python3 -Wignore:Deprecation -m unittest discover
|
runif python3 -Wignore:Deprecation -m unittest discover
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user