From ece9f6e25f8e82776542a6b84bc464483e67c3cf Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Tue, 21 Apr 2020 16:26:52 +0200 Subject: [PATCH] Add pep8 import order check Set flake8-import-order version to 0.17.1 Full py3 compatible version. Add all Python3 modules to stdlib list. Also includes fix to an enum34 dependency bug. Change-Id: I58dd80fc33942656c69ce67ee523a1d57f693e93 --- ansible/action_plugins/tenks_update_state.py | 1 + ansible/roles/virtualbmc-domain/library/virtualbmc_domain.py | 4 ++-- test-requirements.txt | 2 ++ tests/test_tenks_update_state.py | 3 ++- tests/test_tenks_wait_for_resources.py | 2 +- tests/utils.py | 1 - tox.ini | 3 +++ 7 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ansible/action_plugins/tenks_update_state.py b/ansible/action_plugins/tenks_update_state.py index d2089ef..6b0635d 100644 --- a/ansible/action_plugins/tenks_update_state.py +++ b/ansible/action_plugins/tenks_update_state.py @@ -14,6 +14,7 @@ # Avoid shadowing of system copy module by copy action plugin. from __future__ import absolute_import + import abc from copy import deepcopy import itertools diff --git a/ansible/roles/virtualbmc-domain/library/virtualbmc_domain.py b/ansible/roles/virtualbmc-domain/library/virtualbmc_domain.py index 3e41bbb..c1485a4 100644 --- a/ansible/roles/virtualbmc-domain/library/virtualbmc_domain.py +++ b/ansible/roles/virtualbmc-domain/library/virtualbmc_domain.py @@ -12,12 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. -from ansible.module_utils.basic import AnsibleModule # noqa - import json import os.path import time +from ansible.module_utils.basic import AnsibleModule # noqa + DOCUMENTATION = ''' --- diff --git a/test-requirements.txt b/test-requirements.txt index ef07ccd..a68f9c4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,3 +6,5 @@ ansible-lint>=3.0.0 # MIT coverage>=4.5.1 # Apache-2.0 flake8>=3.5.0 # MIT stestr>=1.0.0 # Apache-2.0 +flake8-import-order>=0.17.1 # LGPLv3 + diff --git a/tests/test_tenks_update_state.py b/tests/test_tenks_update_state.py index 42c5deb..c99a6c3 100644 --- a/tests/test_tenks_update_state.py +++ b/tests/test_tenks_update_state.py @@ -13,13 +13,14 @@ # under the License. from __future__ import absolute_import + import copy import imp import os +import unittest from ansible.errors import AnsibleActionFail import six -import unittest # Python 2/3 compatibility. diff --git a/tests/test_tenks_wait_for_resources.py b/tests/test_tenks_wait_for_resources.py index c2ef8eb..b8a104c 100644 --- a/tests/test_tenks_wait_for_resources.py +++ b/tests/test_tenks_wait_for_resources.py @@ -13,6 +13,7 @@ # under the License. from __future__ import absolute_import + import copy import imp import json @@ -21,7 +22,6 @@ import random from itertools import repeat, chain, cycle from ansible.module_utils import basic - from tests.utils import ModuleTestCase, set_module_args, AnsibleExitJson, \ AnsibleFailJson diff --git a/tests/utils.py b/tests/utils.py index 2b10d07..1e5bc8c 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,5 +1,4 @@ import json - import unittest from ansible.module_utils import basic diff --git a/tox.ini b/tox.ini index b9ac003..72cd58b 100644 --- a/tox.ini +++ b/tox.ini @@ -87,3 +87,6 @@ show-source = True extend-ignore = E123,E125 builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build +import-order-style = pep8 +application-import-names = tenks +filename = *.py