aboutsummaryrefslogtreecommitdiffstats
path: root/test/Makefile
diff options
context:
space:
mode:
authorKlement Sekera <klement.sekera@gmail.com>2022-04-26 19:02:15 +0200
committerOle Tr�an <otroan@employees.org>2022-05-10 18:52:08 +0000
commitd9b0c6fbf7aa5bd9af84264105b39c82028a4a29 (patch)
tree4f786cfd8ebc2443cb11e11b74c8657204068898 /test/Makefile
parentf90348bcb4afd0af2611cefc43b17ef3042b511c (diff)
tests: replace pycodestyle with black
Drop pycodestyle for code style checking in favor of black. Black is much faster, stable PEP8 compliant code style checker offering also automatic formatting. It aims to be very stable and produce smallest diffs. It's used by many small and big projects. Running checkstyle with black takes a few seconds with a terse output. Thus, test-checkstyle-diff is no longer necessary. Expand scope of checkstyle to all python files in the repo, replacing test-checkstyle with checkstyle-python. Also, fixstyle-python is now available for automatic style formatting. Note: python virtualenv has been consolidated in test/Makefile, test/requirements*.txt which will eventually be moved to a central location. This is required to simply the automated generation of docker executor images in the CI. Type: improvement Change-Id: I022a326603485f58585e879ac0f697fceefbc9c8 Signed-off-by: Klement Sekera <klement.sekera@gmail.com> Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'test/Makefile')
-rw-r--r--test/Makefile58
1 files changed, 25 insertions, 33 deletions
diff --git a/test/Makefile b/test/Makefile
index 82cef838978..b416bc3f5a3 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -73,10 +73,10 @@ V=0
endif
PYTHON_VERSION=$(shell $(PYTHON_INTERP) -c 'import sys; print(sys.version_info.major)')
-PIP_VERSION=22.0.3
+PIP_VERSION=22.0.4
# Keep in sync with requirements.txt
-PIP_TOOLS_VERSION=6.5.0
-PIP_SETUPTOOLS_VERSION=60.7.1
+PIP_TOOLS_VERSION=6.6.0
+PIP_SETUPTOOLS_VERSION=62.1.0
PYTHON_DEPENDS=requirements-$(PYTHON_VERSION).txt
SCAPY_SOURCE=$(shell find $(VENV_PATH)/lib/python* -name site-packages)
BUILD_COV_DIR=$(TEST_BR)/coverage
@@ -344,37 +344,35 @@ wipe-papi:
wipe-all: wipe wipe-papi wipe-cov
@rm -rf $(TEST_BR)
-.PHONY: checkstyle-diff
-checkstyle-diff: $(PIP_INSTALL_DONE)
- @bash -c "source $(VENV_PATH)/bin/activate &&\
- python3 -m pip install pycodestyle"
- @bash -c "source $(VENV_PATH)/bin/activate &&\
- cd $(WS_ROOT) && git diff --name-only --no-color --relative HEAD~1 ':!*.patch' | grep '.py$$' | xargs -I XXX \
- pycodestyle --show-source --ignore=W504,E126,E241,E226,E305,E704,E741,E722 -v XXX ||\
- (echo \"*********************************************************************\" &&\
- echo \"* Test framework PEP8 compliance check FAILED (checked changed files)\" &&\
- echo \"*********************************************************************\" &&\
- false)"
- @echo "*********************************************************************"
- @echo "* Test framework PEP8 compliance check passed (checked changed files)"
- @echo "*********************************************************************"
-
.PHONY: start-gdb
start-gdb: sanity
@bash -c "source $(VENV_PATH)/bin/activate && python3 -c 'from debug import start_vpp_in_gdb; start_vpp_in_gdb()' $(RUN_TESTS_ARGS)"
-.PHONY: checkstyle
-checkstyle: $(PIP_INSTALL_DONE)
+.PHONY: checkstyle-python-all
+checkstyle-python-all: $(PIP_INSTALL_DONE)
@bash -c "source $(VENV_PATH)/bin/activate &&\
- python3 -m pip install pycodestyle"
+ black -t py39 --diff $(WS_ROOT) ||\
+ (echo \"*************************************************************************\" &&\
+ echo \"* Test framework PEP8 compliance check FAILED (maybe: make fixstyle-python)\" &&\
+ echo \"*************************************************************************\" &&\
+ false)"
+ @echo "*******************************************************************"
+ @echo "* Test framework PEP8 compliance check passed"
+ @echo "*******************************************************************"
+
+.PHONY: checkstyle
+checkstyle: checkstyle-python-all
+
+.PHONY: fixstyle-python-all
+fixstyle-python-all: $(PIP_INSTALL_DONE)
@bash -c "source $(VENV_PATH)/bin/activate &&\
- pycodestyle --show-source --ignore=W504,E126,E241,E226,E305,E704,E741,E722 -v *.py ||\
- (echo \"*******************************************************************\" &&\
- echo \"* Test framework PEP8 compliance check FAILED (checked all files)\" &&\
- echo \"*******************************************************************\" &&\
- false)"
+ black -t py39 $(WS_ROOT) ||\
+ (echo \"*************************************************************************\" &&\
+ echo \"* Test framework PEP8 compliance check FAILED (maybe: make fixstyle-python)\" &&\
+ echo \"*************************************************************************\" &&\
+ false)"
@echo "*******************************************************************"
- @echo "* Test framework PEP8 compliance check passed (checked all files)"
+ @echo "* Test framework PEP8 compliance check passed"
@echo "*******************************************************************"
.PHONY: help
@@ -397,7 +395,6 @@ help:
@echo " test-wipe-all - wipe (temporary) files generated by unit tests, and coverage"
@echo " test-shell - enter shell with test environment"
@echo " test-shell-debug - enter shell with test environment (debug build)"
- @echo " test-checkstyle - check PEP8 compliance for test framework"
@echo " test-refresh-deps - refresh the Python dependencies for the tests"
@echo ""
@echo "Arguments controlling test runs:"
@@ -456,8 +453,3 @@ help:
@echo ""
@echo " test-cov - generate code coverage report for test framework"
@echo " test-wipe-cov - wipe code coverage report for test framework"
- @echo ""
- @echo "Verifying code-style:"
- @echo ""
- @echo " test-checkstyle - check PEP8 compliance"
- @echo ""