From dcf1e78bef938ea8a3200ba0e313dd49a19caeeb Mon Sep 17 00:00:00 2001 From: Ben Beasley Date: Fri, 14 Jan 2022 11:04:12 -0500 Subject: [PATCH] Drop PyPI mock test dependency (#2190) The functionality is in the standard library as unittest.mock beginning with Python 3.3. Since https://github.com/aws-cloudformation/cfn-lint/pull/2195 removed support for everything below Python 3.6, the dependency can be removed unconditionally. --- test/unit/module/cfn_json/test_cfn_json.py | 2 +- test/unit/module/cfn_yaml/test_yaml.py | 2 +- test/unit/module/config/test_config_file_args.py | 2 +- test/unit/module/config/test_config_mixin.py | 2 +- test/unit/module/core/test_run_cli.py | 2 +- test/unit/module/custom_rules/test_custom_rules.py | 2 +- test/unit/module/helpers/test_downloads_metadata.py | 2 +- test/unit/module/helpers/test_get_url_content.py | 4 ++-- test/unit/module/maintenance/test_update_documentation.py | 2 +- test/unit/module/maintenance/test_update_iam_policies.py | 2 +- test/unit/module/maintenance/test_update_resource_specs.py | 2 +- tox.ini | 1 - 12 files changed, 12 insertions(+), 13 deletions(-) diff --git a/test/unit/module/cfn_json/test_cfn_json.py b/test/unit/module/cfn_json/test_cfn_json.py index fdbd1232ce..b9a8ea6423 100644 --- a/test/unit/module/cfn_json/test_cfn_json.py +++ b/test/unit/module/cfn_json/test_cfn_json.py @@ -4,7 +4,7 @@ """ from test.testlib.testcase import BaseTestCase from six import StringIO -from mock import patch +from unittest.mock import patch from cfnlint.template import Template # pylint: disable=E0401 from cfnlint.rules import RulesCollection from cfnlint.core import DEFAULT_RULESDIR # pylint: disable=E0401 diff --git a/test/unit/module/cfn_yaml/test_yaml.py b/test/unit/module/cfn_yaml/test_yaml.py index eda754fab6..4a50e4029e 100644 --- a/test/unit/module/cfn_yaml/test_yaml.py +++ b/test/unit/module/cfn_yaml/test_yaml.py @@ -4,7 +4,7 @@ """ from test.testlib.testcase import BaseTestCase from six import StringIO -from mock import patch +from unittest.mock import patch from cfnlint.template import Template # pylint: disable=E0401 from cfnlint.rules import RulesCollection from cfnlint.core import DEFAULT_RULESDIR # pylint: disable=E0401 diff --git a/test/unit/module/config/test_config_file_args.py b/test/unit/module/config/test_config_file_args.py index b98d8d5c61..e1c5dfb1c9 100644 --- a/test/unit/module/config/test_config_file_args.py +++ b/test/unit/module/config/test_config_file_args.py @@ -5,7 +5,7 @@ import logging from test.testlib.testcase import BaseTestCase import jsonschema -from mock import patch +from unittest.mock import patch import cfnlint.config # pylint: disable=E0401 try: # pragma: no cover from pathlib import Path diff --git a/test/unit/module/config/test_config_mixin.py b/test/unit/module/config/test_config_mixin.py index 1c3213af91..763abf4635 100644 --- a/test/unit/module/config/test_config_mixin.py +++ b/test/unit/module/config/test_config_mixin.py @@ -5,7 +5,7 @@ import logging import os from test.testlib.testcase import BaseTestCase -from mock import patch +from unittest.mock import patch import cfnlint.config # pylint: disable=E0401 from cfnlint.helpers import REGIONS diff --git a/test/unit/module/core/test_run_cli.py b/test/unit/module/core/test_run_cli.py index 57230558f5..d6a71ffa79 100644 --- a/test/unit/module/core/test_run_cli.py +++ b/test/unit/module/core/test_run_cli.py @@ -7,7 +7,7 @@ from six import StringIO import cfnlint.core # pylint: disable=E0401 import cfnlint.config # pylint: disable=E0401 -from mock import patch +from unittest.mock import patch LOGGER = logging.getLogger('cfnlint') diff --git a/test/unit/module/custom_rules/test_custom_rules.py b/test/unit/module/custom_rules/test_custom_rules.py index 818e5a7213..d2eb640eb0 100644 --- a/test/unit/module/custom_rules/test_custom_rules.py +++ b/test/unit/module/custom_rules/test_custom_rules.py @@ -4,7 +4,7 @@ """ from test.testlib.testcase import BaseTestCase from six import StringIO -from mock import patch +from unittest.mock import patch from cfnlint.template import Template # pylint: disable=E0401 from cfnlint.rules import RulesCollection from cfnlint.core import DEFAULT_RULESDIR # pylint: disable=E0401 diff --git a/test/unit/module/helpers/test_downloads_metadata.py b/test/unit/module/helpers/test_downloads_metadata.py index 7a027b0f56..f76517cd55 100644 --- a/test/unit/module/helpers/test_downloads_metadata.py +++ b/test/unit/module/helpers/test_downloads_metadata.py @@ -5,7 +5,7 @@ import sys import os from test.testlib.testcase import BaseTestCase -from mock import patch, MagicMock, mock_open +from unittest.mock import patch, MagicMock, mock_open import cfnlint.helpers import json diff --git a/test/unit/module/helpers/test_get_url_content.py b/test/unit/module/helpers/test_get_url_content.py index 95f4ec3ee2..6054d38cf1 100644 --- a/test/unit/module/helpers/test_get_url_content.py +++ b/test/unit/module/helpers/test_get_url_content.py @@ -9,7 +9,7 @@ except: pass from test.testlib.testcase import BaseTestCase -from mock import patch, MagicMock +from unittest.mock import patch, MagicMock import cfnlint.helpers @@ -146,4 +146,4 @@ def test_url_has_newer_version_negative(self, mock_load_metadata, mocked_urlopen mocked_urlopen.return_value = cm result = cfnlint.helpers.url_has_newer_version(url) - self.assertTrue(result) \ No newline at end of file + self.assertTrue(result) diff --git a/test/unit/module/maintenance/test_update_documentation.py b/test/unit/module/maintenance/test_update_documentation.py index 1837e72c50..3c2e2f46bd 100644 --- a/test/unit/module/maintenance/test_update_documentation.py +++ b/test/unit/module/maintenance/test_update_documentation.py @@ -5,7 +5,7 @@ import sys import logging from test.testlib.testcase import BaseTestCase -from mock import patch, mock_open, call +from unittest.mock import patch, mock_open, call import cfnlint.maintenance from cfnlint.rules import CloudFormationLintRule, RulesCollection diff --git a/test/unit/module/maintenance/test_update_iam_policies.py b/test/unit/module/maintenance/test_update_iam_policies.py index e0bf53eb93..c202d9fed4 100644 --- a/test/unit/module/maintenance/test_update_iam_policies.py +++ b/test/unit/module/maintenance/test_update_iam_policies.py @@ -5,7 +5,7 @@ import sys import logging from test.testlib.testcase import BaseTestCase -from mock import patch +from unittest.mock import patch import cfnlint.maintenance LOGGER = logging.getLogger('cfnlint.maintenance') diff --git a/test/unit/module/maintenance/test_update_resource_specs.py b/test/unit/module/maintenance/test_update_resource_specs.py index da4da10b6c..71cbe20b6f 100644 --- a/test/unit/module/maintenance/test_update_resource_specs.py +++ b/test/unit/module/maintenance/test_update_resource_specs.py @@ -6,7 +6,7 @@ import logging import zipfile from test.testlib.testcase import BaseTestCase -from mock import patch, MagicMock, Mock, ANY +from unittest.mock import patch, MagicMock, Mock, ANY import cfnlint.maintenance try: from urllib.request import urlopen, Request diff --git a/tox.ini b/tox.ini index c1391041d9..4a0ab90b99 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,6 @@ commands = coverage xml skip_install = True deps = - mock coverage pydot setenv =