mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
python: add a pycodestyle test
Look for pycodestyle, and use it to check all the Python sources (tests and auxiliary scripts included) of the Python bindings.
This commit is contained in:
@@ -20,3 +20,4 @@
|
|||||||
# mostly used in other shell scripts.
|
# mostly used in other shell scripts.
|
||||||
|
|
||||||
export XMLLINT="@XMLLINT@"
|
export XMLLINT="@XMLLINT@"
|
||||||
|
export PYCODESTYLE="@PYCODESTYLE@"
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ AS_IF([test "x$enable_python" != "xno"],[
|
|||||||
PYTHON_EXT_SUFFIX=$python_ext_suffix
|
PYTHON_EXT_SUFFIX=$python_ext_suffix
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT([$PYTHON_EXT_SUFFIX])
|
AC_MSG_RESULT([$PYTHON_EXT_SUFFIX])
|
||||||
|
|
||||||
|
AC_CHECK_PROGS([PYCODESTYLE],[pycodestyle],[no])
|
||||||
|
AM_CONDITIONAL([HAVE_PYCODESTYLE], [test "x$PYCODESTYLE" != "xno"])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_SUBST(PYTHON_PREFIX)
|
AC_SUBST(PYTHON_PREFIX)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ EXTRA_DIST = \
|
|||||||
setup.py.in \
|
setup.py.in \
|
||||||
run-bindtests \
|
run-bindtests \
|
||||||
run-python-tests \
|
run-python-tests \
|
||||||
|
test-pycodestyle.sh \
|
||||||
t/__init__.py \
|
t/__init__.py \
|
||||||
t/README \
|
t/README \
|
||||||
t/test[0-9]*.py
|
t/test[0-9]*.py
|
||||||
@@ -121,6 +122,10 @@ if ENABLE_APPLIANCE
|
|||||||
TESTS += run-python-tests
|
TESTS += run-python-tests
|
||||||
endif ENABLE_APPLIANCE
|
endif ENABLE_APPLIANCE
|
||||||
|
|
||||||
|
if HAVE_PYCODESTYLE
|
||||||
|
TESTS += test-pycodestyle.sh
|
||||||
|
endif
|
||||||
|
|
||||||
endif HAVE_PYTHON
|
endif HAVE_PYTHON
|
||||||
|
|
||||||
# Extra clean.
|
# Extra clean.
|
||||||
|
|||||||
28
python/test-pycodestyle.sh
Executable file
28
python/test-pycodestyle.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash -
|
||||||
|
# libguestfs
|
||||||
|
# Copyright (C) 2020 Red Hat Inc.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
$TEST_FUNCTIONS
|
||||||
|
skip_if_skipped
|
||||||
|
|
||||||
|
# Gather the list of Python sources.
|
||||||
|
# (-u is passed to to sort to avoid duplicates in case builddir==srcdir)
|
||||||
|
files="$(find "$srcdir" . -name '*.py' | sort -u)"
|
||||||
|
|
||||||
|
$PYCODESTYLE $files
|
||||||
Reference in New Issue
Block a user