aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile17
-rw-r--r--test/test_bfd.py2
-rw-r--r--test/util.py3
3 files changed, 19 insertions, 3 deletions
diff --git a/test/Makefile b/test/Makefile
index 543fe913c55..db64ad93e07 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -77,6 +77,20 @@ cov: wipe-cov reset verify-python-path $(PAPI_INSTALL_DONE)
wipe-cov: wipe
@rm -rf $(BUILD_COV_DIR)
+.PHONY: checkstyle
+checkstyle: verify-python-path
+ @virtualenv $(PYTHON_VENV_PATH) -p python2.7
+ @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS) pep8"
+ @bash -c "source $(PYTHON_VENV_PATH)/bin/activate &&\
+ pep8 --show-source -v $(WS_ROOT)/test/*.py ||\
+ (echo \"*******************************************************************\" &&\
+ echo \"* Test framework PEP8 compliance check FAILED \" &&\
+ echo \"*******************************************************************\" &&\
+ false)"
+ @echo "*******************************************************************"
+ @echo "* Test framework PEP8 compliance check passed"
+ @echo "*******************************************************************"
+
help:
@echo "Running tests:"
@echo ""
@@ -106,3 +120,6 @@ help:
@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 " test-checkstyle - check PEP8 compliance"
+ @echo ""
diff --git a/test/test_bfd.py b/test/test_bfd.py
index b6222524a4e..b783224732f 100644
--- a/test/test_bfd.py
+++ b/test/test_bfd.py
@@ -27,8 +27,6 @@ class BFDAPITestCase(VppTestCase):
super(BFDAPITestCase, cls).tearDownClass()
raise
-
-
def test_add_bfd(self):
""" create a BFD session """
session = VppBFDUDPSession(self, self.pg0, self.pg0.remote_ip4)
diff --git a/test/util.py b/test/util.py
index ae887a54543..7989360216a 100644
--- a/test/util.py
+++ b/test/util.py
@@ -41,7 +41,8 @@ def ip4_range(ip4, s, e):
def ip4n_range(ip4n, s, e):
ip4 = socket.inet_ntop(socket.AF_INET, ip4n)
- return (socket.inet_pton(socket.AF_INET, ip) for ip in ip4_range(ip4, s, e))
+ return (socket.inet_pton(socket.AF_INET, ip)
+ for ip in ip4_range(ip4, s, e))
class NumericConstant(object):