File: tools

package info (click to toggle)
python-flake8 3.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,176 kB
  • sloc: python: 5,764; makefile: 20; sh: 20
file content (28 lines) | stat: -rw-r--r-- 627 bytes parent folder | download
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