From 2527faec28466e04990c6aaf83b012e878a07aa0 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 27 Feb 2020 09:02:46 -0600 Subject: [PATCH] Remove F403 and F405 exclusions Importing from * is not a thing that should be done, as it masks errors and makes code hard to understand. There are some copy-pasta files that violate this. Mark them with noqa for now, because we don't actually care about them. Change-Id: I790f88c75ea546d83e347e42df0050ad36211936 --- tests/unit/compat/mock.py | 8 ++++---- tests/unit/compat/unittest.py | 4 ++-- tox.ini | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/unit/compat/mock.py b/tests/unit/compat/mock.py index e03260a2..eb88b798 100644 --- a/tests/unit/compat/mock.py +++ b/tests/unit/compat/mock.py @@ -33,12 +33,12 @@ try: # Allow wildcard import because we really do want to import all of mock's # symbols into this compat shim # pylint: disable=wildcard-import,unused-wildcard-import - from unittest.mock import * + from unittest.mock import * # noqa except ImportError: # Python 2 # pylint: disable=wildcard-import,unused-wildcard-import try: - from mock import * + from mock import * # noqa except ImportError: print('You need the mock library installed on python2.x to run tests') @@ -102,9 +102,9 @@ if sys.version_info >= (3,) and sys.version_info < (3, 4, 4): file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO)))) if mock is None: - mock = MagicMock(name='open', spec=open) + mock = MagicMock(name='open', spec=open) # noqa - handle = MagicMock(spec=file_spec) + handle = MagicMock(spec=file_spec) # noqa handle.__enter__.return_value = handle _data = _iterate_read_data(read_data) diff --git a/tests/unit/compat/unittest.py b/tests/unit/compat/unittest.py index 98f08ad6..4b21f2b0 100644 --- a/tests/unit/compat/unittest.py +++ b/tests/unit/compat/unittest.py @@ -31,8 +31,8 @@ import sys if sys.version_info < (2, 7): try: # Need unittest2 on python2.6 - from unittest2 import * + from unittest2 import * # noqa except ImportError: print('You need unittest2 installed on python2.6.x to run tests') else: - from unittest import * + from unittest import * # noqa diff --git a/tox.ini b/tox.ini index 685d0b56..47a63853 100644 --- a/tox.ini +++ b/tox.ini @@ -51,7 +51,7 @@ commands = {posargs} # H4 are rules for docstrings. Maybe we should clean them? # E501,E402,H301,H236,F401,E128 are ignored so we can import the existing # modules unchanged and then clean them in subsequent patches. -ignore = W503,H4,E501,E402,H301,H236,F401,E128,W504,F403,F405 +ignore = W503,H4,E501,E402,H301,H236,F401,E128,W504 show-source = True exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible_collections