From 8260b3f68e0030c39c965e97e8a7616314a2b5a3 Mon Sep 17 00:00:00 2001 From: Michal Nowikowski Date: Thu, 21 Feb 2019 09:42:35 +0100 Subject: [PATCH] cleaned up style, added script for checking style --- .gitlab-ci.yml | 7 +----- check-style.sh | 8 +++++++ .../kea_only/config_backend/test_cb_config.py | 23 +++++++++++++++---- 3 files changed, 27 insertions(+), 11 deletions(-) create mode 100755 check-style.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d30d1be2..0e6a427c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,9 +2,4 @@ pylint: image: python:2.7 script: - pip install pylint pytest pycodestyle --quiet - - cd lettuce - - PY_FILES=`find features/{dhcpv4,dhcpv6,other_tests}/ -name '*.py'` - - PY_FILES="$PY_FILES feat2py.py" - - echo "$PY_FILES" - - pylint --rcfile=../pylint.rc $PY_FILES - - pycodestyle --max-line-length=2000--ignore=E722 $PY_FILES + - ./check-style.sh diff --git a/check-style.sh b/check-style.sh new file mode 100755 index 00000000..66454830 --- /dev/null +++ b/check-style.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e -x + +pushd lettuce +PY_FILES=`find features/{dhcpv4,dhcpv6,other_tests}/ -name '*.py'` +PY_FILES="$PY_FILES feat2py.py" +pylint --rcfile=../pylint.rc $PY_FILES +pycodestyle --max-line-length=2000 --ignore=E722 $PY_FILES diff --git a/lettuce/features/dhcpv4/server/kea_only/config_backend/test_cb_config.py b/lettuce/features/dhcpv4/server/kea_only/config_backend/test_cb_config.py index b58b0e45..3efb345f 100644 --- a/lettuce/features/dhcpv4/server/kea_only/config_backend/test_cb_config.py +++ b/lettuce/features/dhcpv4/server/kea_only/config_backend/test_cb_config.py @@ -76,7 +76,10 @@ def test_v4_config_backend_subnet_set_and_del(): '{"command": "config-get", "arguments": {}}') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', - '{"command":"remote-subnet4-set","arguments":{"remote":{"type":"mysql"},"server-tags":["abc-my-server"],"subnets":[{"subnet": "192.168.50.0/24","interface": "$(SERVER_IFACE)","pools": [{"pool": "192.168.50.100-192.168.50.100"}]}]}}') + '{"command":"remote-subnet4-set","arguments":{"remote":{"type":"mysql"},' + '"server-tags":["abc-my-server"],"subnets":[{"subnet": "192.168.50.0/24",' + '"interface": "$(SERVER_IFACE)","pools": ' + '[{"pool": "192.168.50.100-192.168.50.100"}]}]}}') srv_control.start_srv('DHCP', 'restarted') @@ -90,7 +93,8 @@ def test_v4_config_backend_subnet_set_and_del(): srv_msg.send_wait_for_message('MUST', None, 'OFFER') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', - '{"command":"remote-subnet4-del-by-id", "arguments": {"subnets":[{"id":1}],"remote":{"type":"mysql"},"server-tags":["all"]}}}') + '{"command":"remote-subnet4-del-by-id", "arguments": ' + '{"subnets":[{"id":1}],"remote":{"type":"mysql"},"server-tags":["all"]}}}') srv_control.start_srv('DHCP', 'restarted') @@ -120,13 +124,22 @@ def test_v4_config_backend_subnet_set_2(): '{"command":"list-commands"}') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', - '{"command":"remote-subnet4-set","arguments":{"remote":{"type":"mysql"},"server-tags":["abc"],"subnets":[{"subnet": "192.168.50.0/24","interface": "$(SERVER_IFACE)","pools": [{"pool": "192.168.50.1-192.168.50.100"}]}]}}') + '{"command":"remote-subnet4-set","arguments":{"remote":' + '{"type":"mysql"},"server-tags":["abc"],"subnets":' + '[{"subnet": "192.168.50.0/24","interface": "$(SERVER_IFACE)",' + '"pools": [{"pool": "192.168.50.1-192.168.50.100"}]}]}}') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', - '{"command":"remote-subnet4-set","arguments":{"remote":{"type":"mysql"},"server-tags":["def"],"subnets":[{"subnet": "192.168.51.0/24","interface": "$(SERVER_IFACE)","pools": [{"pool": "192.168.51.1-192.168.51.100"}]}]}}') + '{"command":"remote-subnet4-set","arguments":{"remote":' + '{"type":"mysql"},"server-tags":["def"],"subnets":[{"subnet": ' + '"192.168.51.0/24","interface": "$(SERVER_IFACE)","pools": ' + '[{"pool": "192.168.51.1-192.168.51.100"}]}]}}') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', - '{"command":"remote-subnet4-set","arguments":{"remote":{"type":"mysql"},"server-tags":["xyz"],"subnets":[{"subnet": "192.168.52.0/24","interface": "$(SERVER_IFACE)","pools": [{"pool": "192.168.52.1-192.168.52.100"}]}]}}') + '{"command":"remote-subnet4-set","arguments":{"remote":' + '{"type":"mysql"},"server-tags":["xyz"],"subnets":[{"subnet": ' + '"192.168.52.0/24","interface": "$(SERVER_IFACE)","pools": ' + '[{"pool": "192.168.52.1-192.168.52.100"}]}]}}') srv_control.start_srv('DHCP', 'restarted') srv_msg.test_pause() -- GitLab