From 2c27834adda33d6e4e56d477e476fb3d076133c4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 2 Feb 2024 11:28:35 +0900 Subject: [PATCH] Get rid of 3rd party mock ... by replacing it by the built-in unittest.mock . Change-Id: Ie853237d5c59730353d5ea4a7e61888e066614be --- diskimage_builder/block_device/tests/test_gpt.py | 2 +- diskimage_builder/block_device/tests/test_lvm.py | 2 +- diskimage_builder/block_device/tests/test_mbr.py | 2 +- diskimage_builder/block_device/tests/test_mount_order.py | 2 +- diskimage_builder/elements/growvols/tests/test_growvols.py | 3 ++- .../elements/package-installs/tests/test_package_squash.py | 2 +- diskimage_builder/tests/test_diskimage_builder.py | 7 ++++--- requirements.txt | 4 ---- test-requirements.txt | 5 ----- 9 files changed, 11 insertions(+), 18 deletions(-) diff --git a/diskimage_builder/block_device/tests/test_gpt.py b/diskimage_builder/block_device/tests/test_gpt.py index c3978db45..5c4c80bee 100644 --- a/diskimage_builder/block_device/tests/test_gpt.py +++ b/diskimage_builder/block_device/tests/test_gpt.py @@ -12,8 +12,8 @@ import fixtures import logging -import mock import os +from unittest import mock import diskimage_builder.block_device.tests.test_config as tc diff --git a/diskimage_builder/block_device/tests/test_lvm.py b/diskimage_builder/block_device/tests/test_lvm.py index db2942831..1844a6850 100644 --- a/diskimage_builder/block_device/tests/test_lvm.py +++ b/diskimage_builder/block_device/tests/test_lvm.py @@ -12,7 +12,7 @@ import copy import logging -import mock +from unittest import mock import diskimage_builder.block_device.tests.test_config as tc diff --git a/diskimage_builder/block_device/tests/test_mbr.py b/diskimage_builder/block_device/tests/test_mbr.py index 0645ee515..d0d7c08f3 100644 --- a/diskimage_builder/block_device/tests/test_mbr.py +++ b/diskimage_builder/block_device/tests/test_mbr.py @@ -12,9 +12,9 @@ import fixtures import logging -import mock import os import subprocess +from unittest import mock import diskimage_builder.block_device.tests.test_base as tb diff --git a/diskimage_builder/block_device/tests/test_mount_order.py b/diskimage_builder/block_device/tests/test_mount_order.py index 06d34e486..28362bb6e 100644 --- a/diskimage_builder/block_device/tests/test_mount_order.py +++ b/diskimage_builder/block_device/tests/test_mount_order.py @@ -12,8 +12,8 @@ import functools import logging -import mock import os +from unittest import mock import diskimage_builder.block_device.tests.test_config as tc diff --git a/diskimage_builder/elements/growvols/tests/test_growvols.py b/diskimage_builder/elements/growvols/tests/test_growvols.py index 32736f723..e411b6c64 100644 --- a/diskimage_builder/elements/growvols/tests/test_growvols.py +++ b/diskimage_builder/elements/growvols/tests/test_growvols.py @@ -12,9 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. import importlib -import mock import os import sys +from unittest import mock + from oslotest import base diff --git a/diskimage_builder/elements/package-installs/tests/test_package_squash.py b/diskimage_builder/elements/package-installs/tests/test_package_squash.py index 2ea0665ba..939cef403 100644 --- a/diskimage_builder/elements/package-installs/tests/test_package_squash.py +++ b/diskimage_builder/elements/package-installs/tests/test_package_squash.py @@ -14,9 +14,9 @@ import collections import functools import importlib -import mock import os import sys +from unittest import mock from oslotest import base from testtools.matchers import Mismatch diff --git a/diskimage_builder/tests/test_diskimage_builder.py b/diskimage_builder/tests/test_diskimage_builder.py index 30b3b7da2..16a4693fb 100644 --- a/diskimage_builder/tests/test_diskimage_builder.py +++ b/diskimage_builder/tests/test_diskimage_builder.py @@ -12,12 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. -import jsonschema -import mock +import os import subprocess import tempfile +from unittest import mock + +import jsonschema import testtools -import os import yaml from diskimage_builder import diskimage_builder as dib diff --git a/requirements.txt b/requirements.txt index 067d95f09..9f24d2fd5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,3 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - networkx>=2.3.0 # BSD pbr!=2.1.0,>=2.0.0 # Apache-2.0 PyYAML>=3.12 # MIT diff --git a/test-requirements.txt b/test-requirements.txt index 6ffd7c437..1e5ec975f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,11 +1,6 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - pylint>=1.7.1 #GPLv2 fixtures>=3.0.0 # Apache-2.0/BSD -mock>=2.0.0 # BSD oslotest>=3.2.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 testtools>=2.2.0 # MIT