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: Ibb42643faf23bba4a91019b87e7d23e8b36ce1a7
This commit is contained in:
parent
9fe5717345
commit
6aa9de447e
@ -16,9 +16,9 @@
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
from glanceclient.common import utils as glance_utils
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture as cfg_fixture
|
||||
import testtools
|
||||
|
@ -12,8 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
import ddt
|
||||
|
||||
|
@ -12,15 +12,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
import shutil
|
||||
import stat
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezer.engine.rsync import rsync
|
||||
from mock import patch
|
||||
|
||||
|
||||
class TestRsyncEngine(unittest.TestCase):
|
||||
|
@ -14,8 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from freezer.openstack import osclients
|
||||
|
||||
|
@ -14,9 +14,8 @@
|
||||
|
||||
import signal
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezer.scheduler import daemon
|
||||
|
||||
|
@ -11,14 +11,14 @@
|
||||
# WITHOUT 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 os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezer.scheduler import utils
|
||||
|
||||
|
@ -14,9 +14,8 @@
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezer.snapshot import lvm
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from freezer.tests.commons import FakeDisableFileSystemRedirection
|
||||
|
||||
|
@ -16,11 +16,10 @@ import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezer.storage import ftp
|
||||
from mock import patch
|
||||
|
||||
|
||||
class BaseFtpStorageTestCase(unittest.TestCase):
|
||||
|
@ -17,8 +17,8 @@
|
||||
Freezer main.py related tests
|
||||
"""
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezer import job as jobs
|
||||
from freezer.tests import commons
|
||||
|
@ -15,9 +15,8 @@
|
||||
import io
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezer.utils.checksum import CheckSum
|
||||
|
||||
|
@ -17,7 +17,7 @@ import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
# import mock
|
||||
# from unittest import mock
|
||||
# from mock import patch
|
||||
|
||||
from freezer.utils import crypt
|
||||
|
@ -14,9 +14,8 @@
|
||||
|
||||
import subprocess
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezer.utils import exec_cmd
|
||||
|
||||
|
@ -17,11 +17,8 @@ import datetime
|
||||
import fixtures
|
||||
import os
|
||||
import time
|
||||
|
||||
|
||||
import mock
|
||||
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezer.exceptions import utils as exception_utils
|
||||
from freezer.openstack import osclients
|
||||
|
@ -14,8 +14,7 @@
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from freezer.tests import commons
|
||||
from freezer.utils import winutils
|
||||
|
@ -43,7 +43,6 @@ linecache2==1.0.0
|
||||
logilab-common==1.4.1
|
||||
MarkupSafe==1.0
|
||||
mccabe==0.4.0
|
||||
mock==2.0.0
|
||||
monotonic==1.4
|
||||
msgpack==0.5.6
|
||||
munch==2.2.0
|
||||
|
@ -5,7 +5,6 @@ flake8<2.6.0,>=2.5.4 # MIT
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
coverage>=4.5.1 # Apache-2.0
|
||||
ddt>=1.0.1 # MIT
|
||||
mock>=2.0.0 # BSD
|
||||
#pylint==1.9.2 # GPLv2
|
||||
stestr>=2.0.0 # Apache-2.0
|
||||
testtools>=2.2.0 # MIT
|
||||
|
Loading…
Reference in New Issue
Block a user