Browse Source

Remove the dependency on the "mock" package

This repo is 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.

This patch moves all references to "import mock" to
"from unittest import mock".

Fixed one related functional test failure.

Conflicts:
  ovn_octavia_provider/tests/functional/test_driver.py

Change-Id: I4f7568b1af254488cbc75aefac2a1708e70eaf31
(cherry picked from commit 88ea5cf828)
changes/62/794662/1
Brian Haley 1 year ago
committed by Flavio Fernandes
parent
commit
7d719a225d
4 changed files with 6 additions and 5 deletions
  1. +3
    -2
      ovn_octavia_provider/tests/functional/test_driver.py
  2. +1
    -1
      ovn_octavia_provider/tests/unit/common/test_clients.py
  3. +1
    -1
      ovn_octavia_provider/tests/unit/fakes.py
  4. +1
    -1
      ovn_octavia_provider/tests/unit/test_driver.py

+ 3
- 2
ovn_octavia_provider/tests/functional/test_driver.py View File

@ -15,9 +15,10 @@
import atexit
import copy
import multiprocessing as mp
from unittest import mock
import mock
from neutron.common import utils as n_utils
from neutron_lib.plugins import directory
from octavia_lib.api.drivers import data_models as octavia_data_model
@ -288,7 +289,7 @@ class TestOvnOctaviaBase(
# 'provisioning_status': 'ACTIVE'}]},
updated_statuses = []
for call in update_loadbalancer_status.mock_calls:
updated_statuses.append(call.args[0])
updated_statuses.append(call[1][0])
calls_found = []
for expected_status in expected_statuses:
for updated_status in updated_statuses:


+ 1
- 1
ovn_octavia_provider/tests/unit/common/test_clients.py View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
#
import mock
from unittest import mock
from oslotest import base


+ 1
- 1
ovn_octavia_provider/tests/unit/fakes.py View File

@ -13,8 +13,8 @@
#
import copy
from unittest import mock
import mock
from oslo_utils import uuidutils
from ovn_octavia_provider.common import constants


+ 1
- 1
ovn_octavia_provider/tests/unit/test_driver.py View File

@ -13,8 +13,8 @@
#
import copy
import os
from unittest import mock
import mock
from neutron.tests import base
from neutronclient.common import exceptions as n_exc
from octavia_lib.api.drivers import data_models


Loading…
Cancel
Save