Merge "python3.12: "fix" unittests"

This commit is contained in:
Zuul 2024-01-25 01:42:52 +00:00 committed by Gerrit Code Review
commit c8f1cc11e2
3 changed files with 35 additions and 12 deletions

View File

@ -11,14 +11,22 @@
# 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 imp
import importlib
import mock
import os
import sys
from oslotest import base
module_path = (os.path.dirname(os.path.realpath(__file__)) +
'/../static/usr/local/sbin/growvols')
growvols = imp.load_source('growvols', module_path)
importlib.machinery.SOURCE_SUFFIXES.append('')
file_path = (os.path.dirname(os.path.realpath(__file__)) +
'/../static/usr/local/sbin/growvols')
spec = importlib.util.spec_from_file_location('growvols', file_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
sys.modules['growvols'] = module
growvols = module
importlib.machinery.SOURCE_SUFFIXES.pop()
# output of lsblk -Po kname,pkname,name,label,type,fstype,mountpoint
LSBLK = """KNAME="sda" PKNAME="" NAME="sda" LABEL="" TYPE="disk" FSTYPE="" MOUNTPOINT=""

View File

@ -13,16 +13,23 @@
# under the License.
import collections
import functools
import imp
import importlib
import mock
import os
import sys
from oslotest import base
from testtools.matchers import Mismatch
installs_squash_src = (os.path.dirname(os.path.realpath(__file__)) +
'/../bin/package-installs-squash')
installs_squash = imp.load_source('installs_squash', installs_squash_src)
importlib.machinery.SOURCE_SUFFIXES.append('')
file_path = (os.path.dirname(os.path.realpath(__file__)) +
'/../bin/package-installs-squash')
spec = importlib.util.spec_from_file_location('installs_squash', file_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
sys.modules['installs_squash'] = module
installs_squash = module
importlib.machinery.SOURCE_SUFFIXES.pop()
class IsMatchingInstallList(object):

View File

@ -11,13 +11,21 @@
# 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 imp
import importlib
import os
import sys
from oslotest import base
module_path = (os.path.dirname(os.path.realpath(__file__)) +
'/../extra-data.d/10-merge-svc-map-files')
service_map = imp.load_source('service_map', module_path)
importlib.machinery.SOURCE_SUFFIXES.append('')
file_path = (os.path.dirname(os.path.realpath(__file__)) +
'/../extra-data.d/10-merge-svc-map-files')
spec = importlib.util.spec_from_file_location('service_map', file_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
sys.modules['service_map'] = module
service_map = module
importlib.machinery.SOURCE_SUFFIXES.pop()
class TestDataMerge(base.BaseTestCase):