From ee900ac77a0d44a6b06a8fe0ccba4e6aa129a5a7 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 6 Apr 2018 05:27:29 +0000 Subject: [PATCH] Framework: provide test and style-python targets --- Makefile | 4 ++-- Mk/plugins.mk | 12 ++++++++++++ .../scripts/OPNsense/HelloWorld/testConnection.py | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 455b3bb12..70ad29f3c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017 Franco Fichtner +# Copyright (c) 2015-2018 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -42,7 +42,7 @@ list: .endfor # shared targets that are sane to run from the root directory -TARGETS= lint sweep style style-fix clean +TARGETS= clean lint style style-fix style-python sweep test .for TARGET in ${TARGETS} ${TARGET}: diff --git a/Mk/plugins.mk b/Mk/plugins.mk index e90541039..5dc11935a 100644 --- a/Mk/plugins.mk +++ b/Mk/plugins.mk @@ -312,4 +312,16 @@ style-fix: check fi .endfor +style-python: check + @if [ -d ${.CURDIR}/src ]; then \ + pycodestyle --ignore=E501 ${.CURDIR}/src || true; \ + fi + +test: check + @if [ -d ${.CURDIR}/src/opnsense/mvc/tests ]; then \ + cd /usr/local/opnsense/mvc/tests && \ + phpunit --configuration PHPunit.xml \ + ${.CURDIR}/src/opnsense/mvc/tests; \ + fi + .PHONY: check diff --git a/devel/helloworld/src/opnsense/scripts/OPNsense/HelloWorld/testConnection.py b/devel/helloworld/src/opnsense/scripts/OPNsense/HelloWorld/testConnection.py index 836182013..5fc37c3b5 100755 --- a/devel/helloworld/src/opnsense/scripts/OPNsense/HelloWorld/testConnection.py +++ b/devel/helloworld/src/opnsense/scripts/OPNsense/HelloWorld/testConnection.py @@ -57,7 +57,7 @@ if os.path.exists(hello_world_config): result['message'] = 'test ok!' except smtplib.SMTPException as error: # unable to send mail - result['message'] = '%s'%error + result['message'] = '%s' % error except socket.error as error: # connect error if error.strerror is None: