File: check.sh

package info (click to toggle)
python-flake8 7.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,224 kB
  • sloc: python: 6,634; sh: 21; makefile: 19
file content (33 lines) | stat: -rwxr-xr-x 670 bytes parent folder | download | duplicates (4)
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
29
30
31
32
33
#!/bin/sh
set -efu

CMD=$1

# test good file
$CMD 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

# test know-bad file
set +e
$CMD $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