summaryrefslogtreecommitdiffstats
path: root/debian/tests/python
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:06:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:06:00 +0000
commitb15a952c52a6825376d3e7f6c1bf5c886c6d8b74 (patch)
tree1500f2f8f276908a36d8126cb632c0d6b1276764 /debian/tests/python
parentAdding upstream version 5.10.209. (diff)
downloadlinux-debian.tar.xz
linux-debian.zip
Adding debian version 5.10.209-2.debian/5.10.209-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/python')
-rwxr-xr-xdebian/tests/python40
1 files changed, 40 insertions, 0 deletions
diff --git a/debian/tests/python b/debian/tests/python
new file mode 100755
index 000000000..c743f21ef
--- /dev/null
+++ b/debian/tests/python
@@ -0,0 +1,40 @@
+#!/bin/bash -eu
+
+sources="$AUTOPKGTEST_TMP/sources"
+
+{
+ # Check Python modules under debian/lib and Python scripts under
+ # debian/bin or debian/rules.d.
+ find debian/lib/python -name '*.py'
+ find debian/bin debian/rules.d -type f -perm /111 |
+ while read script; do
+ # Check for Python shebang on the first line only
+ if awk '/^#!.*python/ { exit 0 } { exit 1 }' "$script"; then
+ echo "$script"
+ fi
+ done
+} > "$sources"
+
+# autopkgtest checks for a non-zero exit code *or* any output to
+# stderr. So we should continue after a failure, but make sure
+# something is written to stderr.
+
+echo "I: Running pycodestyle..."
+# Ignore E126,E226,W503 (ignored by default) and also E127,W291 which
+# give false positives.
+if ! xargs pycodestyle --max-line-length=100 --ignore E126,E127,E226,W291,W503 < "$sources"; then
+ # pycodestyle only writes to stdout
+ echo >&2 "E: pycodestyle detected problems"
+fi
+
+echo "I: Running pyflakes..."
+if ! xargs pyflakes3 < "$sources"; then
+ # pyflakes only writes to stdout
+ echo >&2 "E: pyflakes detected problems"
+fi
+
+echo "I: Running debian_linux.debian unit tests..."
+# unittest only writes to stderr
+if ! PYTHONPATH=debian/lib/python python3 -m debian_linux.debian 2>&1; then
+ echo >&2 "E: some unit tests failed"
+fi