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
|
#!/bin/sh
set -efu
flake8 setup.py
# create a known-bad file
cat << EOF > $AUTOPKGTEST_TMP/test.py
import sys # unused import
print('Hello world, this is an overly long line for PEP-8. We expect flake8 to complain')
# undeclared variable
count += 1
EOF
set +e
flake8 $AUTOPKGTEST_TMP/test.py > $AUTOPKGTEST_TMP/out
RC=$?
set -e
echo 'flake8 output on known-bad file:'
cat $AUTOPKGTEST_TMP/out
if [ $RC -eq 0 ]; then
echo "flake8 expected to fail, but it succeeded:" >&2
exit 1
fi
grep -q 'F401.*sys' $AUTOPKGTEST_TMP/out
grep -q 'E501.*line too long' $AUTOPKGTEST_TMP/out
grep -q 'F821.*count' $AUTOPKGTEST_TMP/out
|