Fixes py3 unit tests for nova.tests.unit.test_block_device.*
- test_mappings_prepend_dev: Unorderable types: python3 ignores cmp on dict. Use sorted instead. - test_from_legacy_mapping: There is a fake bdms with a 'boot_index' of None. This caused issue when trying to compare it with an integer. Change-Id: I9d77181b136a5ea611afaf42153bd99a77b4d570 Partially-Implements: blueprint nova-python3-newton
This commit is contained in:
parent
31972f8cbe
commit
a95aef8dc8
@ -120,7 +120,8 @@ class BlockDeviceTestCase(test.NoDBTestCase):
|
||||
{'virtual': 'ephemeral2', 'device': '/dev/sde'}]
|
||||
|
||||
prepended = block_device.mappings_prepend_dev(mapping)
|
||||
self.assertEqual(expected.sort(), prepended.sort())
|
||||
self.assertEqual(sorted(expected, key=lambda v: v['virtual']),
|
||||
sorted(prepended, key=lambda v: v['virtual']))
|
||||
|
||||
def test_strip_dev(self):
|
||||
self.assertEqual('sda', block_device.strip_dev('/dev/sda'))
|
||||
@ -499,7 +500,9 @@ class TestBlockDeviceDict(test.NoDBTestCase):
|
||||
return [bdm for bdm in bdms if bdm['source_type'] == 'image']
|
||||
|
||||
def _get_bootable_bdms(bdms):
|
||||
return [bdm for bdm in bdms if bdm['boot_index'] >= 0]
|
||||
return [bdm for bdm in bdms
|
||||
if (bdm['boot_index'] is not None and
|
||||
bdm['boot_index'] >= 0)]
|
||||
|
||||
new_no_img = block_device.from_legacy_mapping(self.legacy_mapping)
|
||||
self.assertEqual(0, len(_get_image_bdms(new_no_img)))
|
||||
|
@ -89,8 +89,6 @@ nova.tests.unit.pci.test_stats.PciDeviceStatsTestCase
|
||||
nova.tests.unit.pci.test_stats.PciDeviceStatsWithTagsTestCase
|
||||
nova.tests.unit.test_api_validation.Base64TestCase
|
||||
nova.tests.unit.test_bdm.BlockDeviceMappingEc2CloudTestCase
|
||||
nova.tests.unit.test_block_device.BlockDeviceTestCase
|
||||
nova.tests.unit.test_block_device.TestBlockDeviceDict
|
||||
nova.tests.unit.test_cinder.CinderTestCase
|
||||
nova.tests.unit.test_cinder.CinderV2TestCase
|
||||
nova.tests.unit.test_configdrive2.ConfigDriveTestCase
|
||||
|
Loading…
Reference in New Issue
Block a user