Clean up unit test boilerplate.

This commit is contained in:
Matt Clay 2020-06-22 13:27:08 -07:00
parent 4a0f42923b
commit 98a0995fd0
55 changed files with 111 additions and 110 deletions

View file

@ -469,109 +469,27 @@ test/support/windows-integration/plugins/modules/win_regedit.ps1 pslint!skip
test/support/windows-integration/plugins/modules/win_security_policy.ps1 pslint!skip
test/support/windows-integration/plugins/modules/win_shell.ps1 pslint!skip
test/support/windows-integration/plugins/modules/win_wait_for.ps1 pslint!skip
test/units/config/manager/test_find_ini_config_file.py future-import-boilerplate
test/units/executor/test_play_iterator.py pylint:blacklisted-name
test/units/inventory/test_group.py future-import-boilerplate
test/units/inventory/test_group.py metaclass-boilerplate
test/units/inventory/test_host.py future-import-boilerplate
test/units/inventory/test_host.py metaclass-boilerplate
test/units/mock/path.py future-import-boilerplate
test/units/mock/path.py metaclass-boilerplate
test/units/mock/yaml_helper.py future-import-boilerplate
test/units/mock/yaml_helper.py metaclass-boilerplate
test/units/module_utils/basic/test__symbolic_mode_to_octal.py future-import-boilerplate
test/units/module_utils/basic/test_deprecate_warn.py future-import-boilerplate
test/units/module_utils/basic/test_deprecate_warn.py metaclass-boilerplate
test/units/module_utils/basic/test_deprecate_warn.py pylint:ansible-deprecated-no-version
test/units/module_utils/basic/test_deprecate_warn.py pylint:ansible-deprecated-version
test/units/module_utils/basic/test_exit_json.py future-import-boilerplate
test/units/module_utils/basic/test_get_file_attributes.py future-import-boilerplate
test/units/module_utils/basic/test_heuristic_log_sanitize.py future-import-boilerplate
test/units/module_utils/basic/test_run_command.py future-import-boilerplate
test/units/module_utils/basic/test_run_command.py pylint:blacklisted-name
test/units/module_utils/basic/test_safe_eval.py future-import-boilerplate
test/units/module_utils/basic/test_tmpdir.py future-import-boilerplate
test/units/module_utils/common/test_dict_transformations.py future-import-boilerplate
test/units/module_utils/common/test_dict_transformations.py metaclass-boilerplate
test/units/module_utils/conftest.py future-import-boilerplate
test/units/module_utils/conftest.py metaclass-boilerplate
test/units/module_utils/facts/base.py future-import-boilerplate
test/units/module_utils/facts/hardware/test_sunos_get_uptime_facts.py future-import-boilerplate
test/units/module_utils/facts/hardware/test_sunos_get_uptime_facts.py metaclass-boilerplate
test/units/module_utils/facts/network/test_generic_bsd.py future-import-boilerplate
test/units/module_utils/facts/other/test_facter.py future-import-boilerplate
test/units/module_utils/facts/other/test_ohai.py future-import-boilerplate
test/units/module_utils/facts/system/test_lsb.py future-import-boilerplate
test/units/module_utils/facts/test_ansible_collector.py future-import-boilerplate
test/units/module_utils/facts/test_collector.py future-import-boilerplate
test/units/module_utils/facts/test_collectors.py future-import-boilerplate
test/units/module_utils/facts/test_facts.py future-import-boilerplate
test/units/module_utils/facts/test_timeout.py future-import-boilerplate
test/units/module_utils/facts/test_utils.py future-import-boilerplate
test/units/module_utils/json_utils/test_filter_non_json_lines.py future-import-boilerplate
test/units/module_utils/parsing/test_convert_bool.py future-import-boilerplate
test/units/module_utils/test_distro.py future-import-boilerplate
test/units/module_utils/test_distro.py metaclass-boilerplate
test/units/module_utils/urls/fixtures/multipart.txt line-endings # Fixture for HTTP tests that use CRLF
test/units/module_utils/urls/test_Request.py replace-urlopen
test/units/module_utils/urls/test_fetch_url.py replace-urlopen
test/units/modules/conftest.py future-import-boilerplate
test/units/modules/conftest.py metaclass-boilerplate
test/units/modules/test_copy.py future-import-boilerplate
test/units/modules/test_pip.py future-import-boilerplate
test/units/modules/test_pip.py metaclass-boilerplate
test/units/modules/test_apt.py future-import-boilerplate
test/units/modules/test_apt.py metaclass-boilerplate
test/units/modules/test_apt.py pylint:blacklisted-name
test/units/modules/test_yum.py future-import-boilerplate
test/units/modules/test_yum.py metaclass-boilerplate
test/units/modules/test_iptables.py future-import-boilerplate
test/units/modules/test_iptables.py metaclass-boilerplate
test/units/modules/test_known_hosts.py future-import-boilerplate
test/units/modules/test_known_hosts.py metaclass-boilerplate
test/units/modules/test_known_hosts.py pylint:ansible-bad-function
test/units/modules/test_systemd.py future-import-boilerplate
test/units/modules/test_systemd.py metaclass-boilerplate
test/units/modules/utils.py future-import-boilerplate
test/units/modules/utils.py metaclass-boilerplate
test/units/parsing/utils/test_addresses.py future-import-boilerplate
test/units/parsing/utils/test_addresses.py metaclass-boilerplate
test/units/parsing/vault/test_vault.py pylint:blacklisted-name
test/units/playbook/role/test_role.py pylint:blacklisted-name
test/units/playbook/test_attribute.py future-import-boilerplate
test/units/playbook/test_attribute.py metaclass-boilerplate
test/units/playbook/test_conditional.py future-import-boilerplate
test/units/playbook/test_conditional.py metaclass-boilerplate
test/units/plugins/inventory/test_constructed.py future-import-boilerplate
test/units/plugins/inventory/test_constructed.py metaclass-boilerplate
test/units/plugins/loader_fixtures/import_fixture.py future-import-boilerplate
test/units/plugins/shell/test_cmd.py future-import-boilerplate
test/units/plugins/shell/test_cmd.py metaclass-boilerplate
test/units/plugins/shell/test_powershell.py future-import-boilerplate
test/units/plugins/shell/test_powershell.py metaclass-boilerplate
test/units/plugins/test_plugins.py pylint:blacklisted-name
test/units/template/test_templar.py pylint:blacklisted-name
test/units/test_constants.py future-import-boilerplate
test/units/test_context.py future-import-boilerplate
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/action/my_action.py future-import-boilerplate
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/action/my_action.py metaclass-boilerplate
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/module_utils/my_util.py future-import-boilerplate # test expects no boilerplate
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/module_utils/my_util.py metaclass-boilerplate # test expects no boilerplate
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/action/my_action.py pylint:relative-beyond-top-level
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/module_utils/my_other_util.py future-import-boilerplate
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/module_utils/my_other_util.py metaclass-boilerplate
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/module_utils/my_util.py future-import-boilerplate
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/module_utils/my_util.py metaclass-boilerplate
test/units/utils/collection_loader/fixtures/collections/ansible_collections/testns/testcoll/plugins/modules/__init__.py empty-init # testing that collections don't need inits
test/units/utils/collection_loader/fixtures/collections_masked/ansible_collections/__init__.py empty-init # testing that collections don't need inits
test/units/utils/collection_loader/fixtures/collections_masked/ansible_collections/ansible/__init__.py empty-init # testing that collections don't need inits
test/units/utils/collection_loader/fixtures/collections_masked/ansible_collections/testns/__init__.py empty-init # testing that collections don't need inits
test/units/utils/collection_loader/fixtures/collections_masked/ansible_collections/testns/testcoll/__init__.py empty-init # testing that collections don't need inits
test/units/utils/collection_loader/test_collection_loader.py pylint:undefined-variable # magic runtime local var splatting
test/units/utils/test_cleanup_tmp_file.py future-import-boilerplate
test/units/utils/test_encrypt.py future-import-boilerplate
test/units/utils/test_encrypt.py metaclass-boilerplate
test/units/utils/test_helpers.py future-import-boilerplate
test/units/utils/test_helpers.py metaclass-boilerplate
test/units/utils/test_shlex.py future-import-boilerplate
test/units/utils/test_shlex.py metaclass-boilerplate
test/utils/shippable/check_matrix.py replace-urlopen
test/utils/shippable/timing.py shebang

View file

@ -3,7 +3,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from ansible.inventory.group import Group

View file

@ -16,6 +16,10 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# for __setstate__/__getstate__ tests
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pickle
from units.compat import unittest

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import MagicMock
from ansible.utils.path import unfrackpath

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import io
import yaml

View file

@ -5,7 +5,7 @@
# License: GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest

View file

@ -3,6 +3,9 @@
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import pytest

View file

@ -3,7 +3,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json

View file

@ -4,7 +4,7 @@
# License: GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from itertools import product

View file

@ -17,7 +17,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest

View file

@ -3,7 +3,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import errno

View file

@ -3,7 +3,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from itertools import chain

View file

@ -3,7 +3,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json

View file

@ -16,6 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from ansible.module_utils.common.dict_transformations import _camel_to_snake, _snake_to_camel, camel_dict_to_snake_dict, dict_merge

View file

@ -1,6 +1,9 @@
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import sys
from io import BytesIO

View file

@ -16,7 +16,7 @@
#
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import time
from ansible.module_utils.facts.hardware import sunos

View file

@ -15,7 +15,7 @@
#
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import Mock

View file

@ -16,7 +16,7 @@
#
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import Mock, patch

View file

@ -16,7 +16,7 @@
#
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import Mock, patch

View file

@ -16,7 +16,7 @@
#
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import Mock, patch

View file

@ -16,7 +16,7 @@
#
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
# for testing

View file

@ -17,7 +17,7 @@
#
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from collections import defaultdict

View file

@ -16,7 +16,7 @@
#
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import Mock, patch

View file

@ -17,7 +17,7 @@
#
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -17,7 +17,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys

View file

@ -14,7 +14,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest

View file

@ -17,7 +17,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest

View file

@ -3,7 +3,7 @@
# License: GNU General Public License v3 or later (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt )
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest

View file

@ -12,6 +12,9 @@
# Note that nir0s/distro has many more tests in it's test suite. The tests here are
# primarily for testing the vendoring.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils import distro
from ansible.module_utils.six import string_types

View file

@ -1,6 +1,9 @@
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import pytest

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import sys

View file

@ -4,7 +4,7 @@
# License: GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.module_utils import basic
from ansible.modules import iptables

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import tempfile
from ansible.module_utils import basic

View file

@ -1,5 +1,8 @@
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import pytest

View file

@ -1,3 +1,5 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from ansible.modules.systemd import parse_systemctl_show

View file

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from ansible.modules.yum import YumModule

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from units.compat import unittest

View file

@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import unittest
from ansible.parsing.utils.addresses import parse_address

View file

@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from ansible.playbook.attribute import Attribute

View file

@ -1,3 +1,5 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from units.mock.loader import DictDataLoader

View file

@ -17,6 +17,9 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from ansible.errors import AnsibleParserError

View file

@ -1,5 +1,6 @@
# Nothing to see here, this file is just empty to support a imp.load_source
# without doing anything
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from ansible.plugins.shell.cmd import ShellModule

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.shell.powershell import _parse_clixml, ShellModule

View file

@ -17,7 +17,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pwd

View file

@ -3,7 +3,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import context

View file

@ -1,3 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ..module_utils.my_util import question

View file

@ -1 +1,4 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from .my_util import question

View file

@ -2,7 +2,7 @@
# Copyright: (c) 2019, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import pytest

View file

@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import unittest
from ansible.utils.helpers import pct_to_int

View file

@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import unittest
from ansible.utils.shlex import shlex_split