Replace mock with unittest.mock
mock module has been deprecated in favor of unittest.mock which is part of the standard python library. This review removes mock as a third party dependency, and updates all unittest imports to use unittest.mock instead. nova-api-proxy had mock as a test requirement, however it was not using it. This change has no impact on runtime code. Test Plan: PASS: tox passing for nfv PASS: build-pkgs -p nfv PASS: tox passing for nova-api-proxy PASS: build-pkgs -p nova-api-proxy Story: 2010531 Task: 47142 Signed-off-by: Al Bailey <al.bailey@windriver.com> Change-Id: I991d07e87fbdc7fecc4e790550df2472b9b5b24b
This commit is contained in:
parent
d87462c851
commit
0df5aaaf5d
@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2015-2016 Wind River Systems, Inc.
|
# Copyright (c) 2015-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
import mock
|
|
||||||
import random
|
import random
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from nfv_vim.network_rebalance._dhcp_rebalance import _add_network_to_dhcp_agent_callback_body # noqa: H501
|
from nfv_vim.network_rebalance._dhcp_rebalance import _add_network_to_dhcp_agent_callback_body # noqa: H501
|
||||||
from nfv_vim.network_rebalance._dhcp_rebalance import _DHCPRebalance
|
from nfv_vim.network_rebalance._dhcp_rebalance import _DHCPRebalance
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2020 Wind River Systems, Inc.
|
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from nfv_vim import nfvi
|
from nfv_vim import nfvi
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2015-2016 Wind River Systems, Inc.
|
# Copyright (c) 2015-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
import mock
|
from unittest import mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from nfv_vim import nfvi
|
from nfv_vim import nfvi
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2020-2021 Wind River Systems, Inc.
|
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
import mock
|
from unittest import mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from nfv_common import strategy as common_strategy
|
from nfv_common import strategy as common_strategy
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2020-2021 Wind River Systems, Inc.
|
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
import mock
|
from unittest import mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from nfv_common import strategy as common_strategy
|
from nfv_common import strategy as common_strategy
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2015-2016 Wind River Systems, Inc.
|
# Copyright (c) 2015-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
import mock
|
|
||||||
import random
|
import random
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from nfv_vim.network_rebalance._network_rebalance import _L3Rebalance
|
from nfv_vim.network_rebalance._network_rebalance import _L3Rebalance
|
||||||
from nfv_vim.network_rebalance._network_rebalance import _reschedule_down_agent
|
from nfv_vim.network_rebalance._network_rebalance import _reschedule_down_agent
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2015-2016 Wind River Systems, Inc.
|
# Copyright (c) 2015-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
import mock
|
|
||||||
import random
|
import random
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from nfv_vim.network_rebalance._network_rebalance import _add_router_to_agent_callback_body # noqa: H501
|
from nfv_vim.network_rebalance._network_rebalance import _add_router_to_agent_callback_body # noqa: H501
|
||||||
from nfv_vim.network_rebalance._network_rebalance import _get_agent_routers_callback_body # noqa: H501
|
from nfv_vim.network_rebalance._network_rebalance import _get_agent_routers_callback_body # noqa: H501
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright
|
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
import copy
|
import copy
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from nfv_client import shell
|
from nfv_client import shell
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#
|
#
|
||||||
|
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||||
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
# Copyright (C) 2019 Intel Corporation
|
# Copyright (C) 2019 Intel Corporation
|
||||||
@ -6,7 +8,7 @@
|
|||||||
|
|
||||||
import kubernetes
|
import kubernetes
|
||||||
from kubernetes.client.rest import ApiException
|
from kubernetes.client.rest import ApiException
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from nfv_plugins.nfvi_plugins.clients import kubernetes_client
|
from nfv_plugins.nfvi_plugins.clients import kubernetes_client
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2016-2020 Wind River Systems, Inc.
|
# Copyright (c) 2016-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
import mock
|
from unittest import mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from nfv_common import strategy as common_strategy
|
from nfv_common import strategy as common_strategy
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2016-2020 Wind River Systems, Inc.
|
# Copyright (c) 2016-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
import mock
|
|
||||||
import testtools
|
import testtools
|
||||||
|
from unittest import mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from nfv_common import strategy as common_strategy
|
from nfv_common import strategy as common_strategy
|
||||||
|
@ -5,6 +5,5 @@ hacking>=1.1.0,<=2.0.0 # Apache-2.0
|
|||||||
bandit
|
bandit
|
||||||
coverage>=3.6
|
coverage>=3.6
|
||||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||||
mock>=2.0.0 # BSD
|
|
||||||
pylint
|
pylint
|
||||||
testtools>=2.2.0 # MIT
|
testtools>=2.2.0 # MIT
|
||||||
|
@ -128,7 +128,6 @@ commands = bandit --ini tox.ini -f txt -r {[nfv]nfv_base_dir}
|
|||||||
deps = {[nfv]deps}
|
deps = {[nfv]deps}
|
||||||
coverage
|
coverage
|
||||||
fixtures
|
fixtures
|
||||||
mock
|
|
||||||
stestr
|
stestr
|
||||||
testtools
|
testtools
|
||||||
setenv = PYTHONDONTWRITEBYTECODE=True
|
setenv = PYTHONDONTWRITEBYTECODE=True
|
||||||
@ -141,7 +140,6 @@ commands = cp -v {[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/test_data/nfv_vim_
|
|||||||
deps = {[nfv]deps}
|
deps = {[nfv]deps}
|
||||||
coverage
|
coverage
|
||||||
fixtures
|
fixtures
|
||||||
mock
|
|
||||||
stestr
|
stestr
|
||||||
testtools
|
testtools
|
||||||
setenv =
|
setenv =
|
||||||
|
@ -5,5 +5,4 @@ hacking>=1.1.0,<=2.0.0 # Apache-2.0
|
|||||||
bandit<1.6.0;python_version>="3.0"
|
bandit<1.6.0;python_version>="3.0"
|
||||||
coverage>=3.6
|
coverage>=3.6
|
||||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||||
mock>=2.0.0 # BSD
|
|
||||||
pylint
|
pylint
|
||||||
|
Loading…
x
Reference in New Issue
Block a user