diff --git a/lib/ansible/compat/tests/mock.py b/lib/ansible/compat/tests/mock.py index dd83e39167..0972cd2e8e 100644 --- a/lib/ansible/compat/tests/mock.py +++ b/lib/ansible/compat/tests/mock.py @@ -32,11 +32,11 @@ import sys try: # Allow wildcard import because we really do want to import all of mock's # symbols into this compat shim - # pylint: disable=wildcard-import + # pylint: disable=wildcard-import,unused-wildcard-import from unittest.mock import * except ImportError: # Python 2 - # pylint: disable=wildcard-import + # pylint: disable=wildcard-import,unused-wildcard-import try: from mock import * except ImportError: diff --git a/lib/ansible/compat/tests/unittest.py b/lib/ansible/compat/tests/unittest.py index e1fc7e7f5a..98f08ad6a8 100644 --- a/lib/ansible/compat/tests/unittest.py +++ b/lib/ansible/compat/tests/unittest.py @@ -27,7 +27,7 @@ import sys # Allow wildcard import because we really do want to import all of # unittests's symbols into this compat shim -# pylint: disable=wildcard-import +# pylint: disable=wildcard-import,unused-wildcard-import if sys.version_info < (2, 7): try: # Need unittest2 on python2.6 diff --git a/lib/ansible/vars/unsafe_proxy.py b/lib/ansible/vars/unsafe_proxy.py index b97ddb236f..05e5056277 100644 --- a/lib/ansible/vars/unsafe_proxy.py +++ b/lib/ansible/vars/unsafe_proxy.py @@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type # This is backwards compat. unsafe_proxy was moved to avoid circular imports. -from ansible.utils.unsafe_proxy import * # pylint: disable=wildcard-import +from ansible.utils.unsafe_proxy import * # pylint: disable=wildcard-import,unused-wildcard-import try: from __main__ import display diff --git a/test/sanity/code-smell/no-wildcard-import.sh b/test/sanity/code-smell/no-wildcard-import.sh deleted file mode 100755 index d52a81f3bb..0000000000 --- a/test/sanity/code-smell/no-wildcard-import.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# Only needed until we enable pylint test for wildcard imports - - -# The first three paths here are valid uses of wildcard imports -# unsafe_proxy is backwards compat (pylint disabled added) -# module_common.py is picked up from static strings, not from actual imports (pylint won't detect) -# test_action.py is picked up from static strings, not from actual imports (pylint won't detect) -# mock.py is importing code for an installed library for compat (pylint disabled added) -# unittest.py is importing code for an installed library for compat (pylint disabled added) -# -# Everything else needs to be fixed -wildcard_imports=$(find . -path ./test/runner/.tox -prune \ - -o -path ./lib/ansible/vars/unsafe_proxy.py -prune \ - -o -path ./lib/ansible/executor/module_common.py -prune \ - -o -path ./test/units/plugins/action/test_action.py \ - -o -path ./lib/ansible/compat/tests/mock.py -prune \ - -o -path ./lib/ansible/compat/tests/unittest.py \ - -o -name '*.py' -type f -exec grep -H 'import \*' '{}' '+') - - -if test -n "$wildcard_imports" ; then - printf "\n== Wildcard imports detected ==\n" - printf "%s" "$wildcard_imports" - failures=$(printf "%s" "$wildcard_imports"| wc -l) - failures=$((failures + 2)) - exit "$failures" -fi - -exit 0 diff --git a/test/sanity/pylint/config/default b/test/sanity/pylint/config/default index 9e2bd7f7f7..70759d04f6 100644 --- a/test/sanity/pylint/config/default +++ b/test/sanity/pylint/config/default @@ -93,10 +93,8 @@ disable= unused-argument, unused-import, unused-variable, - unused-wildcard-import, used-before-assignment, useless-super-delegation, - wildcard-import, wrong-import-order, wrong-import-position,