From 27077b385cf222830db7c5513a75ef093948ff62 Mon Sep 17 00:00:00 2001 From: asarfaty Date: Sun, 10 May 2020 17:29:29 +0200 Subject: [PATCH] Removing dependency on the "mock" package Now that we are python3 only, we should move to using the built in version of mock that supports all of our testing needs and remove the dependency on the "mock" package. Also see commit: Ifcaf1c21bea0ec3c35278e49cecc90a101a82113 Change-Id: I11dc8a80471be347f89a30f59c1cc14cdb879726 --- lower-constraints.txt | 1 - test-requirements.txt | 1 - vmware_nsxlib/tests/unit/v3/nsxlib_testcase.py | 2 +- .../tests/unit/v3/policy/test_ipsec_vpn_resources.py | 2 +- vmware_nsxlib/tests/unit/v3/policy/test_lb_resources.py | 2 +- vmware_nsxlib/tests/unit/v3/policy/test_resources.py | 2 +- vmware_nsxlib/tests/unit/v3/policy/test_transaction.py | 2 +- vmware_nsxlib/tests/unit/v3/test_cert.py | 2 +- vmware_nsxlib/tests/unit/v3/test_cluster.py | 2 +- vmware_nsxlib/tests/unit/v3/test_cluster_management.py | 2 +- vmware_nsxlib/tests/unit/v3/test_load_balancer.py | 2 +- vmware_nsxlib/tests/unit/v3/test_ns_group_manager.py | 2 +- vmware_nsxlib/tests/unit/v3/test_qos_switching_profile.py | 2 +- vmware_nsxlib/tests/unit/v3/test_resources.py | 2 +- vmware_nsxlib/tests/unit/v3/test_router.py | 3 +-- vmware_nsxlib/tests/unit/v3/test_security.py | 4 ++-- vmware_nsxlib/tests/unit/v3/test_trust_management.py | 2 +- vmware_nsxlib/tests/unit/v3/test_utils.py | 2 +- 18 files changed, 17 insertions(+), 20 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 5475cf29..db9787cd 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -6,7 +6,6 @@ fixtures==3.0.0 flake8==2.6.2 flake8-import-order==0.12 hacking>=1.1.0 # Apache-2.0 -mock==2.0.0 netaddr==0.7.18 openstackdocstheme==1.18.1 oslo.i18n==3.15.3 diff --git a/test-requirements.txt b/test-requirements.txt index 7dc4d8fa..d37e0145 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,7 +8,6 @@ bandit!=1.6.0,>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.00 fixtures>=3.0.0 # Apache-2.0/BSD flake8-import-order==0.12 # LGPLv3 -mock>=2.0.0 # BSD python-subunit>=1.0.0 # Apache-2.0/BSD oslotest>=3.2.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 diff --git a/vmware_nsxlib/tests/unit/v3/nsxlib_testcase.py b/vmware_nsxlib/tests/unit/v3/nsxlib_testcase.py index ef779044..2612d488 100644 --- a/vmware_nsxlib/tests/unit/v3/nsxlib_testcase.py +++ b/vmware_nsxlib/tests/unit/v3/nsxlib_testcase.py @@ -15,8 +15,8 @@ # import copy import unittest +from unittest import mock -import mock from oslo_serialization import jsonutils from oslo_utils import uuidutils from requests import models diff --git a/vmware_nsxlib/tests/unit/v3/policy/test_ipsec_vpn_resources.py b/vmware_nsxlib/tests/unit/v3/policy/test_ipsec_vpn_resources.py index 948d864c..c57b7f06 100644 --- a/vmware_nsxlib/tests/unit/v3/policy/test_ipsec_vpn_resources.py +++ b/vmware_nsxlib/tests/unit/v3/policy/test_ipsec_vpn_resources.py @@ -14,7 +14,7 @@ # under the License. # -import mock +from unittest import mock from vmware_nsxlib.tests.unit.v3.policy import test_resources from vmware_nsxlib.v3.policy import ipsec_vpn_defs diff --git a/vmware_nsxlib/tests/unit/v3/policy/test_lb_resources.py b/vmware_nsxlib/tests/unit/v3/policy/test_lb_resources.py index 954cc770..ac126f4a 100644 --- a/vmware_nsxlib/tests/unit/v3/policy/test_lb_resources.py +++ b/vmware_nsxlib/tests/unit/v3/policy/test_lb_resources.py @@ -14,7 +14,7 @@ # under the License. # -import mock +from unittest import mock from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase from vmware_nsxlib.tests.unit.v3.policy import test_resources diff --git a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py index 57d20f93..69f3a62b 100644 --- a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py +++ b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py @@ -14,7 +14,7 @@ # under the License. # -import mock +from unittest import mock from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase from vmware_nsxlib.tests.unit.v3.policy import policy_testcase diff --git a/vmware_nsxlib/tests/unit/v3/policy/test_transaction.py b/vmware_nsxlib/tests/unit/v3/policy/test_transaction.py index 2e8af0ad..26640c66 100644 --- a/vmware_nsxlib/tests/unit/v3/policy/test_transaction.py +++ b/vmware_nsxlib/tests/unit/v3/policy/test_transaction.py @@ -16,7 +16,7 @@ import copy -import mock +from unittest import mock from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase from vmware_nsxlib.tests.unit.v3.policy import policy_testcase diff --git a/vmware_nsxlib/tests/unit/v3/test_cert.py b/vmware_nsxlib/tests/unit/v3/test_cert.py index 408dbe10..5f0d5840 100644 --- a/vmware_nsxlib/tests/unit/v3/test_cert.py +++ b/vmware_nsxlib/tests/unit/v3/test_cert.py @@ -15,8 +15,8 @@ # import os +from unittest import mock -import mock from OpenSSL import crypto from oslo_serialization import jsonutils diff --git a/vmware_nsxlib/tests/unit/v3/test_cluster.py b/vmware_nsxlib/tests/unit/v3/test_cluster.py index 0facc19d..8732f1c7 100644 --- a/vmware_nsxlib/tests/unit/v3/test_cluster.py +++ b/vmware_nsxlib/tests/unit/v3/test_cluster.py @@ -14,8 +14,8 @@ # under the License. # import unittest +from unittest import mock -import mock from requests import codes from requests import exceptions as requests_exceptions from requests import models diff --git a/vmware_nsxlib/tests/unit/v3/test_cluster_management.py b/vmware_nsxlib/tests/unit/v3/test_cluster_management.py index 369a989f..d525b563 100644 --- a/vmware_nsxlib/tests/unit/v3/test_cluster_management.py +++ b/vmware_nsxlib/tests/unit/v3/test_cluster_management.py @@ -14,7 +14,7 @@ # under the License. # -import mock +from unittest import mock from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase diff --git a/vmware_nsxlib/tests/unit/v3/test_load_balancer.py b/vmware_nsxlib/tests/unit/v3/test_load_balancer.py index 4d85a859..352c96df 100644 --- a/vmware_nsxlib/tests/unit/v3/test_load_balancer.py +++ b/vmware_nsxlib/tests/unit/v3/test_load_balancer.py @@ -14,7 +14,7 @@ # under the License. # -import mock +from unittest import mock from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase from vmware_nsxlib.tests.unit.v3 import test_constants as consts diff --git a/vmware_nsxlib/tests/unit/v3/test_ns_group_manager.py b/vmware_nsxlib/tests/unit/v3/test_ns_group_manager.py index 63b8750c..97946b1d 100644 --- a/vmware_nsxlib/tests/unit/v3/test_ns_group_manager.py +++ b/vmware_nsxlib/tests/unit/v3/test_ns_group_manager.py @@ -12,7 +12,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase from vmware_nsxlib.v3 import exceptions as nsxlib_exc diff --git a/vmware_nsxlib/tests/unit/v3/test_qos_switching_profile.py b/vmware_nsxlib/tests/unit/v3/test_qos_switching_profile.py index ffe6a410..ee788768 100644 --- a/vmware_nsxlib/tests/unit/v3/test_qos_switching_profile.py +++ b/vmware_nsxlib/tests/unit/v3/test_qos_switching_profile.py @@ -14,8 +14,8 @@ # limitations under the License. # import copy +from unittest import mock -import mock from oslo_log import log from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase diff --git a/vmware_nsxlib/tests/unit/v3/test_resources.py b/vmware_nsxlib/tests/unit/v3/test_resources.py index 2d6d080f..841d82c5 100644 --- a/vmware_nsxlib/tests/unit/v3/test_resources.py +++ b/vmware_nsxlib/tests/unit/v3/test_resources.py @@ -14,9 +14,9 @@ # under the License. # import copy +from unittest import mock import eventlet -import mock from oslo_serialization import jsonutils from oslo_utils import uuidutils diff --git a/vmware_nsxlib/tests/unit/v3/test_router.py b/vmware_nsxlib/tests/unit/v3/test_router.py index b117b374..e77f1058 100644 --- a/vmware_nsxlib/tests/unit/v3/test_router.py +++ b/vmware_nsxlib/tests/unit/v3/test_router.py @@ -15,8 +15,7 @@ # import copy - -import mock +from unittest import mock from oslo_utils import uuidutils diff --git a/vmware_nsxlib/tests/unit/v3/test_security.py b/vmware_nsxlib/tests/unit/v3/test_security.py index 517d0ae7..485c343f 100644 --- a/vmware_nsxlib/tests/unit/v3/test_security.py +++ b/vmware_nsxlib/tests/unit/v3/test_security.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock -import six +from unittest import mock from oslo_utils import uuidutils +import six from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase from vmware_nsxlib.tests.unit.v3 import test_constants diff --git a/vmware_nsxlib/tests/unit/v3/test_trust_management.py b/vmware_nsxlib/tests/unit/v3/test_trust_management.py index 1d4ec31e..01c3b534 100644 --- a/vmware_nsxlib/tests/unit/v3/test_trust_management.py +++ b/vmware_nsxlib/tests/unit/v3/test_trust_management.py @@ -14,7 +14,7 @@ # under the License. # -import mock +from unittest import mock from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase from vmware_nsxlib.tests.unit.v3 import test_constants as consts diff --git a/vmware_nsxlib/tests/unit/v3/test_utils.py b/vmware_nsxlib/tests/unit/v3/test_utils.py index e8c25c92..7eca42c3 100644 --- a/vmware_nsxlib/tests/unit/v3/test_utils.py +++ b/vmware_nsxlib/tests/unit/v3/test_utils.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase from vmware_nsxlib.v3 import exceptions