Browse Source

Use unittest.mock instead of third party mock

Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I3e1e5ed4e72837d45b78e5ccb9ce8cca416e5c11
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
tags/8.1.0^0
Sean McGinnis 3 months ago
parent
commit
b903d4e1ee
No known key found for this signature in database GPG Key ID: CE7EE4BFAF8D70C8
15 changed files with 14 additions and 17 deletions
  1. +0
    -1
      lower-constraints.txt
  2. +1
    -1
      oslo_db/tests/sqlalchemy/test_enginefacade.py
  3. +1
    -1
      oslo_db/tests/sqlalchemy/test_exc_filters.py
  4. +1
    -1
      oslo_db/tests/sqlalchemy/test_fixtures.py
  5. +1
    -1
      oslo_db/tests/sqlalchemy/test_migrate_cli.py
  6. +1
    -1
      oslo_db/tests/sqlalchemy/test_migration_common.py
  7. +1
    -1
      oslo_db/tests/sqlalchemy/test_migrations.py
  8. +1
    -1
      oslo_db/tests/sqlalchemy/test_models.py
  9. +1
    -2
      oslo_db/tests/sqlalchemy/test_ndb.py
  10. +1
    -1
      oslo_db/tests/sqlalchemy/test_provision.py
  11. +1
    -1
      oslo_db/tests/sqlalchemy/test_sqlalchemy.py
  12. +1
    -1
      oslo_db/tests/sqlalchemy/test_utils.py
  13. +2
    -1
      oslo_db/tests/test_api.py
  14. +1
    -2
      oslo_db/tests/test_concurrency.py
  15. +0
    -1
      test-requirements.txt

+ 0
- 1
lower-constraints.txt View File

@@ -23,7 +23,6 @@ linecache2==1.0.0
Mako==0.4.0
MarkupSafe==1.0
mccabe==0.2.1
mock==2.0.0
monotonic==0.6
netaddr==0.7.18
netifaces==0.10.4


+ 1
- 1
oslo_db/tests/sqlalchemy/test_enginefacade.py View File

@@ -16,9 +16,9 @@ import copy
import fixtures
import pickle
import sys
from unittest import mock
import warnings

import mock
from oslo_config import cfg
from oslo_context import context as oslo_context
from oslotest import base as oslo_test_base


+ 1
- 1
oslo_db/tests/sqlalchemy/test_exc_filters.py View File

@@ -16,8 +16,8 @@

import contextlib
import itertools
from unittest import mock

import mock
from oslotest import base as oslo_test_base
import sqlalchemy as sqla
from sqlalchemy.engine import url as sqla_url


+ 1
- 1
oslo_db/tests/sqlalchemy/test_fixtures.py View File

@@ -10,11 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.

import mock
import os
import testresources
import testscenarios
import unittest
from unittest import mock

from oslo_db import exception
from oslo_db.sqlalchemy import enginefacade


+ 1
- 1
oslo_db/tests/sqlalchemy/test_migrate_cli.py View File

@@ -9,9 +9,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock

import alembic
import mock
from oslotest import base as test_base
import sqlalchemy



+ 1
- 1
oslo_db/tests/sqlalchemy/test_migration_common.py View File

@@ -16,10 +16,10 @@

import os
import tempfile
from unittest import mock

from migrate import exceptions as migrate_exception
from migrate.versioning import api as versioning_api
import mock
import sqlalchemy

from oslo_db import exception as db_exception


+ 1
- 1
oslo_db/tests/sqlalchemy/test_migrations.py View File

@@ -13,10 +13,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock

import fixtures
from migrate.versioning import api as versioning_api
import mock
from oslotest import base as test
import sqlalchemy as sa
import sqlalchemy.ext.declarative as sa_decl


+ 1
- 1
oslo_db/tests/sqlalchemy/test_models.py View File

@@ -15,8 +15,8 @@

from collections import abc
import datetime
from unittest import mock

import mock
from oslotest import base as oslo_test
from sqlalchemy import Column
from sqlalchemy import Integer, String


+ 1
- 2
oslo_db/tests/sqlalchemy/test_ndb.py View File

@@ -14,8 +14,7 @@
"""Tests for MySQL Cluster (NDB) Support."""

import logging

import mock
from unittest import mock

from oslo_db import exception
from oslo_db.sqlalchemy import enginefacade


+ 1
- 1
oslo_db/tests/sqlalchemy/test_provision.py View File

@@ -10,8 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.

import mock
import os
from unittest import mock

from oslotest import base as oslo_test_base
from sqlalchemy import exc as sa_exc


+ 1
- 1
oslo_db/tests/sqlalchemy/test_sqlalchemy.py View File

@@ -19,9 +19,9 @@

import logging
import os
from unittest import mock

import fixtures
import mock
from oslo_config import cfg
from oslotest import base as oslo_test
import sqlalchemy


+ 1
- 1
oslo_db/tests/sqlalchemy/test_utils.py View File

@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.

from unittest import mock
from urllib import parse

import fixtures
import mock
from oslotest import base as test_base
import sqlalchemy
from sqlalchemy.dialects import mysql


+ 2
- 1
oslo_db/tests/test_api.py View File

@@ -15,7 +15,8 @@

"""Unit tests for DB API."""

import mock
from unittest import mock

from oslo_config import cfg
from oslo_utils import importutils



+ 1
- 2
oslo_db/tests/test_concurrency.py View File

@@ -14,8 +14,7 @@
# under the License.

import sys

import mock
from unittest import mock

from oslo_db import concurrency
from oslo_db.tests import utils as test_utils


+ 0
- 1
test-requirements.txt View File

@@ -5,7 +5,6 @@ hacking>=3.0,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
python-subunit>=1.0.0 # Apache-2.0/BSD
oslotest>=3.2.0 # Apache-2.0
oslo.context>=2.19.2 # Apache-2.0


Loading…
Cancel
Save