Fix Old style classes are deprecated and no longer available in Python 3

[H238] Old style classes are deprecated and no longer available in Python 3
(they are converted to new style classes). In order to avoid any unwanted side
effects all classes should be declared using new style. See the new-style class
documentation for reference on the differences.

http://docs.openstack.org/developer/hacking/#python-3-x-compatibility

Change-Id: I79e2f0d7d53d398fcf5ba18cefc8318ee6e07426
This commit is contained in:
Luong Anh Tuan 2016-09-30 16:04:52 +07:00
parent 11e28a5e51
commit 39bf8d3f7b
12 changed files with 19 additions and 19 deletions

View File

@ -71,7 +71,7 @@ commands = {posargs}
show-source = True
# H301 is ignored on purpose.
# The rest of the ignores are TODOs.
ignore = F821,H237,H238,H301,H404,H405,H501
ignore = F821,H237,H301,H404,H405,H501
builtins = _
exclude=.venv,.tox,.git,dist,doc,*egg,tools,etc,build,*.po,*.pot
filename=*.py,trove-*

View File

@ -144,7 +144,7 @@ class AfterBackupCreation(object):
assert_unprocessable(instance_info.dbaas.backups.delete, backup.id)
class BackupRestoreMixin():
class BackupRestoreMixin(object):
def verify_backup(self, backup_id):
def result_is_active():

View File

@ -1610,7 +1610,7 @@ class CheckInstance(AttrCheck):
@test(groups=[GROUP])
class BadInstanceStatusBug():
class BadInstanceStatusBug(object):
@before_class()
def setUp(self):

View File

@ -54,7 +54,7 @@ class FakeRpcClient(object):
return self
class FakeNotifier:
class FakeNotifier(object):
def info(self, ctxt, event_type, payload):
usage.notify(event_type, payload)

View File

@ -159,7 +159,7 @@ class MockRestoreRunner(RestoreRunner):
return False
class MockStats:
class MockStats(object):
f_blocks = 1024 ** 2
f_bsize = 4096
f_bfree = 512 * 1024

View File

@ -118,7 +118,7 @@ class ClusterTest(trove_testtools.TestCase):
@patch.object(remote, 'create_nova_client')
def test_create_storage_not_specified(self,
mock_client):
class FakeFlavor:
class FakeFlavor(object):
def __init__(self, flavor_id):
self.flavor_id = flavor_id

View File

@ -158,7 +158,7 @@ class ClusterTest(trove_testtools.TestCase):
def test_create_storage_not_specified_and_no_ephemeral_flavor(self,
mock_conf,
mock_client):
class FakeFlavor:
class FakeFlavor(object):
def __init__(self, flavor_id):
self.flavor_id = flavor_id
@ -255,7 +255,7 @@ class ClusterTest(trove_testtools.TestCase):
mock_task_api, mock_db_create,
mock_ins_create, mock_conf,
mock_find_all):
class FakeFlavor:
class FakeFlavor(object):
def __init__(self, flavor_id):
self.flavor_id = flavor_id

View File

@ -129,7 +129,7 @@ class ClusterTest(trove_testtools.TestCase):
def test_create_storage_not_specified_and_no_ephemeral_flavor(self,
mock_conf,
mock_client):
class FakeFlavor:
class FakeFlavor(object):
def __init__(self, flavor_id):
self.flavor_id = flavor_id
@ -180,7 +180,7 @@ class ClusterTest(trove_testtools.TestCase):
def test_create_with_ephemeral_flavor(self, mock_client, mock_check_quotas,
mock_task_api, mock_ins_create,
mock_conf):
class FakeFlavor:
class FakeFlavor(object):
def __init__(self, flavor_id):
self.flavor_id = flavor_id

View File

@ -174,7 +174,7 @@ class ClusterTest(trove_testtools.TestCase):
mock_client,
m_find_all,
mock_create):
class FakeFlavor:
class FakeFlavor(object):
def __init__(self, flavor_id):
self.flavor_id = flavor_id
@ -253,7 +253,7 @@ class ClusterTest(trove_testtools.TestCase):
mock_task_api, mock_db_create,
mock_ins_create, mock_conf,
mock_find_all):
class FakeFlavor:
class FakeFlavor(object):
def __init__(self, flavor_id):
self.flavor_id = flavor_id

View File

@ -107,7 +107,7 @@ class TemplateTest(trove_testtools.TestCase):
class HeatTemplateLoadTest(trove_testtools.TestCase):
class FakeTemplate():
class FakeTemplate(object):
def __init__(self):
self.name = 'mysql/heat.template'

View File

@ -105,7 +105,7 @@ FAKE_USER = [{"_name": "random", "_password": "guesswhat",
"_host": "%", "_databases": [FAKE_DB]}]
class FakeTime:
class FakeTime(object):
COUNTER = 0
@classmethod
@ -1669,7 +1669,7 @@ class MySqlRootStatusTest(trove_testtools.TestCase):
enable_root_mock.assert_called_once_with(root_password=None)
class MockStats:
class MockStats(object):
f_blocks = 1024 ** 2
f_bsize = 4096
f_bfree = 512 * 1024

View File

@ -67,7 +67,7 @@ class FakeOptGroup(object):
self.icmp = icmp
class fake_Server:
class fake_Server(object):
def __init__(self):
self.id = None
self.name = None
@ -80,7 +80,7 @@ class fake_Server:
self.status = 'ACTIVE'
class fake_ServerManager:
class fake_ServerManager(object):
def create(self, name, image_id, flavor_id, files, userdata,
security_groups, block_device_mapping, availability_zone=None,
nics=None, config_drive=False,
@ -99,7 +99,7 @@ class fake_ServerManager:
return server
class fake_nova_client:
class fake_nova_client(object):
def __init__(self):
self.servers = fake_ServerManager()
@ -510,7 +510,7 @@ class ResizeVolumeTest(trove_testtools.TestCase):
self.old_vol_size,
self.new_vol_size)
class FakeGroup():
class FakeGroup(object):
def __init__(self):
self.mount_point = 'var/lib/mysql'
self.device_path = '/dev/vdb'