From 90d02c0a03ad326a6c0768bdfdb2c985a4a91351 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Tue, 17 Dec 2019 14:57:16 +0100 Subject: [PATCH] Use flake8 for testing Start using flake8 for style guide enforcement. Change-Id: I9d7c89498c10e682acf0f75bad20dfd4bb6152b5 --- test-requirements.txt | 1 + tox.ini | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 30b60054..f49f9c5b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,3 +9,4 @@ stestr>=1.0.0 # Apache-2.0 testscenarios>=0.4 testtools>=2.2.0 oslotest>=3.2.0 # Apache-2.0 +flake8-import-order>=0.13 # LGPLv3 \ No newline at end of file diff --git a/tox.ini b/tox.ini index 86f0c736..e644aad7 100644 --- a/tox.ini +++ b/tox.ini @@ -22,6 +22,7 @@ sitepackages = True [testenv:pep8] whitelist_externals = bash +commands = flake8 [testenv:cover] setenv = @@ -40,11 +41,19 @@ commands = python setup.py build_sphinx commands = {posargs} [flake8] -exclude = .venv,.tox,dist,doc,*.egg,build +exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build show-source = true - -[pep8] -ignore = E731,E226,E123 +# E129 visually indented line with same indent as next logical line +# E731 do not assign a lambda expression, use a def +# W504 line break after binary operator +ignore = E129,E731,W504 +# H106: Don't put vim configuration in source files +# H203: Use assertIs(Not)None to check for None +# H204: Use assert(Not)Equal to check for equality +# H205: Use assert(Greater|Less)(Equal) for comparison +# H904: Delay string interpolations at logging calls +enable-extensions=H106,H203,H204,H205,H904 +import-order-style = pep8 [testenv:lower-constraints] deps =