From 8bd6312ebc9c800680694c10a2b77fe7ba9b3c79 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Thu, 15 Feb 2018 20:07:04 +0100 Subject: [PATCH] Add pep8 import order validation Add the flake8-import-order library to our test requirements so that we can avoid these PEP8 violations and maintain consistent import ordering. Also fix our violations. This library is in requirements but is blacklisted from being automatically updated since it is never shipped. For now, don't bother to pin it. Change-Id: I4e788292b98b7f2f835cc80081763b2d249fe43e --- keystoneauth1/identity/v3/tokenless_auth.py | 1 + keystoneauth1/tests/unit/access/test_v3_access.py | 2 +- keystoneauth1/tests/unit/test_betamax_fixture.py | 3 +-- keystoneauth1/tests/unit/test_betamax_hooks.py | 3 ++- keystoneauth1/tests/unit/test_discovery.py | 2 +- test-requirements.txt | 1 + tox.ini | 2 ++ 7 files changed, 9 insertions(+), 5 deletions(-) diff --git a/keystoneauth1/identity/v3/tokenless_auth.py b/keystoneauth1/identity/v3/tokenless_auth.py index 0e7e7f76..f1b3c7a2 100644 --- a/keystoneauth1/identity/v3/tokenless_auth.py +++ b/keystoneauth1/identity/v3/tokenless_auth.py @@ -11,6 +11,7 @@ # under the License. import abc + import six from keystoneauth1 import _utils as utils diff --git a/keystoneauth1/tests/unit/access/test_v3_access.py b/keystoneauth1/tests/unit/access/test_v3_access.py index 53fa94d6..5c122633 100644 --- a/keystoneauth1/tests/unit/access/test_v3_access.py +++ b/keystoneauth1/tests/unit/access/test_v3_access.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +import datetime import uuid -import datetime from oslo_utils import timeutils from keystoneauth1 import access diff --git a/keystoneauth1/tests/unit/test_betamax_fixture.py b/keystoneauth1/tests/unit/test_betamax_fixture.py index b5378219..8984dcd9 100644 --- a/keystoneauth1/tests/unit/test_betamax_fixture.py +++ b/keystoneauth1/tests/unit/test_betamax_fixture.py @@ -10,11 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. -import testtools - import betamax from betamax import exceptions import mock +import testtools from keystoneauth1.fixture import keystoneauth_betamax from keystoneauth1.fixture import serializer diff --git a/keystoneauth1/tests/unit/test_betamax_hooks.py b/keystoneauth1/tests/unit/test_betamax_hooks.py index 9eb78c62..038eb43c 100644 --- a/keystoneauth1/tests/unit/test_betamax_hooks.py +++ b/keystoneauth1/tests/unit/test_betamax_hooks.py @@ -10,8 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -import betamax import json + +import betamax import mock from requests import models import testtools diff --git a/keystoneauth1/tests/unit/test_discovery.py b/keystoneauth1/tests/unit/test_discovery.py index c7bab41e..949746dc 100644 --- a/keystoneauth1/tests/unit/test_discovery.py +++ b/keystoneauth1/tests/unit/test_discovery.py @@ -11,9 +11,9 @@ # under the License. import json -import mock import re +import mock from testtools import matchers from keystoneauth1 import adapter diff --git a/test-requirements.txt b/test-requirements.txt index e042db5e..be9735fd 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,6 +4,7 @@ hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 flake8-docstrings==0.2.1.post1 # MIT +flake8-import-order bandit>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 6d9425a0..da10d83d 100644 --- a/tox.ini +++ b/tox.ini @@ -61,6 +61,8 @@ ignore = D100,D101,D102,D103,D104,D203 enable-extensions=H106,H203 show-source = True exclude = .venv,.tox,dist,doc,*egg,build +import-order-style = pep8 +application-import-names = keystoneauth1 [testenv:docs] deps = -r{toxinidir}/doc/requirements.txt