From d1e88a989e1429d2e51fe8438a9c75ad17abe4f7 Mon Sep 17 00:00:00 2001 From: Yvonne Ding Date: Fri, 13 Nov 2020 21:02:01 +0000 Subject: [PATCH] Use newer flake8 to run on ubuntu-focal Zuul flake8 2.6.2 failed on ubuntu-focal zuul machines running python3.8 with the following error: AttributeError: 'FlakesChecker' object has no attribute 'CONSTANT' pylint failed with following error: ERROR: InvocationError for command /home/zuul/src/opendev.org/starlingx/test/.tox/pylint/bin/pylint --rcfile=pylint.rc automated-p upgrade openstackdocstheme to 2.2.1 and update sphinx version fix releasenotes to use python3 Change-Id: Ie5e11b44a3ff9695a6ec44eaf4a53baababc27ac Signed-off-by: Yvonne Ding --- .zuul.yaml | 8 ++++++-- automated-pytest-suite/keywords/common.py | 2 +- automated-pytest-suite/keywords/kube_helper.py | 2 +- automated-pytest-suite/keywords/system_helper.py | 2 +- doc/requirements.txt | 6 +++--- pylint.rc | 3 ++- test-requirements.txt | 2 +- tox.ini | 13 ++++++++++--- 8 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 5efb01d..c9cb2ca 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -4,12 +4,16 @@ - build-openstack-docs-pti check: jobs: - - build-openstack-releasenotes + - build-openstack-releasenotes: + vars: + sphinx_python: python3 - openstack-tox-pep8 - openstack-tox-pylint gate: jobs: - - build-openstack-releasenotes + - build-openstack-releasenotes: + vars: + sphinx_python: python3 - openstack-tox-pep8 - openstack-tox-pylint post: diff --git a/automated-pytest-suite/keywords/common.py b/automated-pytest-suite/keywords/common.py index 6e98657..be4204d 100644 --- a/automated-pytest-suite/keywords/common.py +++ b/automated-pytest-suite/keywords/common.py @@ -744,7 +744,7 @@ def ssh_to_remote_node(host, username=None, password=None, prompt=None, Examples: with ssh_to_remote_node('128.224.150.92) as remote_ssh: remote_ssh.exec_cmd(cmd) -\ """ + """ if not host: raise exceptions.SSHException( diff --git a/automated-pytest-suite/keywords/kube_helper.py b/automated-pytest-suite/keywords/kube_helper.py index 0a29a0d..dd2cf93 100644 --- a/automated-pytest-suite/keywords/kube_helper.py +++ b/automated-pytest-suite/keywords/kube_helper.py @@ -183,7 +183,7 @@ def get_resources(field='NAME', namespace=None, all_namespaces=None, all_namespaces (bool|None): used only when namespace is unspecified resource_names (str|None|list|tuple): e.g., calico-typha resource_type (str): e.g., "deployments.apps", "pod", "service" - labels (dict|str\list|tuple): Used only when resource_names are + labels (dict|str|list|tuple): Used only when resource_names are unspecified field_selectors (dict|str|list|tuple): Used only when resource_names are unspecified diff --git a/automated-pytest-suite/keywords/system_helper.py b/automated-pytest-suite/keywords/system_helper.py index 1fef776..bb89fd2 100644 --- a/automated-pytest-suite/keywords/system_helper.py +++ b/automated-pytest-suite/keywords/system_helper.py @@ -1958,7 +1958,7 @@ def enable_service(service_name, con_ssh=None, if res == 1: return 1, output - msg = "Service enabled: {]".format(service_name) + msg = "Service enabled: {}".format(service_name) LOG.info(msg) return 0, msg diff --git a/doc/requirements.txt b/doc/requirements.txt index fc6294f..87faef9 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,6 @@ # Documentation Sphinx -sphinx>=1.8.2 # BSD -openstackdocstheme>=1.26.0 # Apache-2.0 +sphinx>=2.0.0,!=2.1.0 # BSD +openstackdocstheme>=2.2.1 # Apache-2.0 # Documentation Release Notes -reno>=0.1.1 +reno>=3.1.0 diff --git a/pylint.rc b/pylint.rc index 655e01c..cab52b7 100644 --- a/pylint.rc +++ b/pylint.rc @@ -52,6 +52,7 @@ load-plugins= # W0702 bare-except # W0703 broad except warning # W0706 try-except-raise +# W0707 raise-missing-from # W1113 keyword-arg-before-vararg # W1302 bad-format-string # W1308 duplicate-string-formatting-argument @@ -71,7 +72,7 @@ disable=C,R, W0401,W0402,W0404, W0511, W0601,W0603,W0611,W0612,W0613,W0621,W0622,W0632, - W0702,W0703,W0706, + W0702,W0703,W0706,W0707, W1113,W1302,W1308,W1401, E0102,E0401,E0611,E0711,E1102,E1120,E1136,E1305 diff --git a/test-requirements.txt b/test-requirements.txt index d4d9e91..4a5f695 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -hacking>=1.1.0,<1.2.0 # Apache-2.0 +hacking pylint PyYAML>=3.1.0 yamllint>=0.5.2 diff --git a/tox.ini b/tox.ini index b0adcc3..e4f840a 100644 --- a/tox.ini +++ b/tox.ini @@ -36,6 +36,7 @@ commands = pylint --rcfile=pylint.rc automated-pytest-suite automated-robot-suit [testenv:pep8] basepython = python3 +deps = flake8<3.8.3 commands = flake8 {posargs} [flake8] @@ -57,6 +58,8 @@ commands = flake8 {posargs} # W292 no newline at end of file # W391 blank line at end of file # W503 line break before binary operator +# W504 line break after binary operator +# W605 Invalid escape sequence 'x' # # E121 continuation line under-indented for hanging indent # E123 closing bracket does not match indentation of opening bracket's line @@ -69,18 +72,22 @@ commands = flake8 {posargs} # E302 expected 2 blank lines, found 1 # E303 too many blank lines # E713 test for membership should be 'not in' +# E722 do not use bare except' # E731 do not assign a lambda expression, use a def # # F401 'X' imported but unused # F403 ‘from module import *’ used; unable to detect undefined names +# F523 unused positional arguments +# F632 use ==/!= to compare str, bytes, and int literals # F811 redefinition of unused 'X' from line 'Y' # F841 local variable 'X' is assigned to but never used +# F901 raise NotImplemented should be raise NotImplementedError # ignore = H101,H104,H201,H238,H301,H306,H401,H403,H404,H405,H903, - W291,W292,W391,W503, - E121,E123,E126,E127,E128,E226,E261,E241,E302,E303,E713,E731, - F401,F403,F811,F841 + W291,W292,W391,W503,W504,W605 + E121,E123,E126,E127,E128,E226,E261,E241,E302,E303,E713,E722,E731, + F401,F403,F523,F632,F811,F841,F901 show-source = True exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build,doc/source/conf.py,releasenotes # Default max-line-length is 80. This should be reduced as the files are cleaned up.