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: I5587ac8f603798aad27908d3bd6ed8ebb3a9c14e
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
tags/4.1.1^0
Sean McGinnis 3 months ago
parent
commit
2aaf7b08a6
No known key found for this signature in database GPG Key ID: CE7EE4BFAF8D70C8
7 changed files with 11 additions and 10 deletions
  1. +0
    -1
      lower-constraints.txt
  2. +3
    -3
      oslo_log/tests/unit/test_formatters.py
  3. +4
    -2
      oslo_log/tests/unit/test_helpers.py
  4. +1
    -1
      oslo_log/tests/unit/test_log.py
  5. +1
    -1
      oslo_log/tests/unit/test_rate_limit.py
  6. +2
    -1
      oslo_log/tests/unit/test_versionutils.py
  7. +0
    -1
      test-requirements.txt

+ 0
- 1
lower-constraints.txt View File

@@ -22,7 +22,6 @@ keystoneauth1==3.4.0
linecache2==1.0.0
MarkupSafe==1.0
mccabe==0.2.1
mock==2.0.0
monotonic==1.4;python_version<'3.3'
mox3==0.25.0
msgpack==0.5.6


+ 3
- 3
oslo_log/tests/unit/test_formatters.py View File

@@ -14,17 +14,17 @@

"""Unit Tests for oslo.log formatter"""

import mock

import logging
import sys
from unittest import mock

from oslo_config import cfg
from oslo_config import fixture as config_fixture
from oslo_context import context
from oslotest import base as test_base

from oslo_log import formatters
from oslo_log import log
from oslotest import base as test_base


def _fake_context():


+ 4
- 2
oslo_log/tests/unit/test_helpers.py View File

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

import mock
from oslo_log import helpers
from unittest import mock
from oslotest import base as test_base

from oslo_log import helpers


class LogHelpersTestCase(test_base.BaseTestCase):



+ 1
- 1
oslo_log/tests/unit/test_log.py View File

@@ -31,9 +31,9 @@ except ImportError:
syslog = None
import tempfile
import time
from unittest import mock

from dateutil import tz
import mock
from oslo_config import cfg
from oslo_config import fixture as fixture_config # noqa
from oslo_context import context


+ 1
- 1
oslo_log/tests/unit/test_rate_limit.py View File

@@ -14,8 +14,8 @@

import io
import logging
from unittest import mock

import mock
from oslotest import base as test_base

from oslo_log import rate_limit


+ 2
- 1
oslo_log/tests/unit/test_versionutils.py View File

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

import mock
from unittest import mock

from oslotest import base as test_base
from testtools import matchers



+ 0
- 1
test-requirements.txt View File

@@ -6,7 +6,6 @@ hacking>=2.0.0,<2.1.0 # Apache-2.0

stestr>=2.0.0 # Apache-2.0
testtools>=2.3.0 # MIT
mock>=2.0.0 # BSD
oslotest>=3.3.0 # Apache-2.0

coverage>=4.5.1 # Apache-2.0


Loading…
Cancel
Save