Port virt vmwareapi tests to Python 3
* ensure etree.fromstring accept bytes string * Fix mock object comparison failure in Python 3 Partially-Implements: blueprint goal-python35 Change-Id: I915b2eacce74bafd7887a96e0e8d1f4eafb6ed78
This commit is contained in:
parent
90f01d5ebb
commit
3fe0faa09d
@ -967,6 +967,12 @@ class VMwareVMOpsTestCase(test.NoDBTestCase):
|
||||
self.flags(flat_injected=False)
|
||||
self.flags(enabled=False, group='vnc')
|
||||
|
||||
mock_vi = mock.Mock()
|
||||
mock_vi.root_gb = 1
|
||||
mock_vi.ii.file_size = 2 * units.Gi
|
||||
mock_vi.instance.flavor.root_gb = 1
|
||||
mock_get_vm_config_info.return_value = mock_vi
|
||||
|
||||
# Call spawn(). We don't care what it does as long as it generates
|
||||
# the log message, which we check below.
|
||||
with mock.patch.object(self._vmops, '_volumeops') as mock_vo:
|
||||
|
@ -24,6 +24,7 @@ from lxml import etree
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import loopingcall
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import units
|
||||
from oslo_vmware import rw_handles
|
||||
@ -368,7 +369,7 @@ def fetch_image_stream_optimized(context, instance, session, vm_name,
|
||||
def get_vmdk_name_from_ovf(xmlstr):
|
||||
"""Parse the OVA descriptor to extract the vmdk name."""
|
||||
|
||||
ovf = etree.fromstring(xmlstr)
|
||||
ovf = etree.fromstring(encodeutils.safe_encode(xmlstr))
|
||||
nsovf = "{%s}" % ovf.nsmap["ovf"]
|
||||
|
||||
disk = ovf.find("./%sDiskSection/%sDisk" % (nsovf, nsovf))
|
||||
|
@ -21,9 +21,6 @@ nova.tests.unit.virt.libvirt.test_imagebackend.LvmTestCase
|
||||
nova.tests.unit.virt.libvirt.test_imagebackend.FlatTestCase
|
||||
nova.tests.unit.virt.libvirt.test_imagebackend.RbdTestCase
|
||||
nova.tests.unit.virt.libvirt.test_vif.LibvirtVifTestCase
|
||||
nova.tests.unit.virt.vmwareapi.test_images.VMwareImagesTestCase
|
||||
nova.tests.unit.virt.vmwareapi.test_read_write_util.ReadWriteUtilTestCase
|
||||
nova.tests.unit.virt.vmwareapi.test_vmops.VMwareVMOpsTestCase.test_spawn_mask_block_device_info_password
|
||||
nova.tests.unit.virt.xenapi.test_vm_utils.ResizeFunctionTestCase
|
||||
nova.tests.unit.virt.xenapi.test_vm_utils.ScanSrTestCase
|
||||
nova.tests.unit.virt.xenapi.test_vm_utils.UnplugVbdTestCase
|
||||
|
Loading…
Reference in New Issue
Block a user