Merge "trivial: Don't use 'Test' prefix for non-TestCase classes"

This commit is contained in:
Zuul 2018-02-20 00:52:01 +00:00 committed by Gerrit Code Review
commit 14458d9f93
3 changed files with 26 additions and 26 deletions

View File

@ -2770,7 +2770,7 @@ class CommonNetworkTestCase(test.TestCase):
cidr='10.1.0.0/24', fixed_cidr='10.1.1.0/25')
class TestRPCFixedManager(network_manager.RPCAllocateFixedIP,
class FakeRPCFixedManager(network_manager.RPCAllocateFixedIP,
network_manager.NetworkManager):
"""Dummy manager that implements RPCAllocateFixedIP."""
@ -2779,7 +2779,7 @@ class RPCAllocateTestCase(test.NoDBTestCase):
"""Tests nova.network.manager.RPCAllocateFixedIP."""
def setUp(self):
super(RPCAllocateTestCase, self).setUp()
self.rpc_fixed = TestRPCFixedManager()
self.rpc_fixed = FakeRPCFixedManager()
self.context = context.RequestContext('fake', 'fake')
def test_rpc_allocate(self):
@ -2804,7 +2804,7 @@ class RPCAllocateTestCase(test.NoDBTestCase):
self.assertEqual(address, rval)
class TestFloatingIPManager(floating_ips.FloatingIP,
class FakeFloatingIPManager(floating_ips.FloatingIP,
network_manager.NetworkManager):
"""Dummy manager that implements FloatingIP."""
@ -2941,7 +2941,7 @@ class FloatingIPTestCase(test.TestCase):
super(FloatingIPTestCase, self).setUp()
self.tempdir = self.useFixture(fixtures.TempDir()).path
self.flags(log_dir=self.tempdir)
self.network = TestFloatingIPManager()
self.network = FakeFloatingIPManager()
self.network.db = db
self.project_id = fakes.FAKE_PROJECT_ID
self.context = context.RequestContext('testuser', self.project_id,
@ -3462,7 +3462,7 @@ class InstanceDNSTestCase(test.TestCase):
super(InstanceDNSTestCase, self).setUp()
self.tempdir = self.useFixture(fixtures.TempDir()).path
self.flags(log_dir=self.tempdir)
self.network = TestFloatingIPManager()
self.network = FakeFloatingIPManager()
self.network.db = db
self.project_id = fakes.FAKE_PROJECT_ID
self.context = context.RequestContext('testuser', self.project_id,

View File

@ -119,7 +119,7 @@ class RandomMixInWithNoFields(object):
@base.NovaObjectRegistry.register_if(False)
class TestSubclassedObject(RandomMixInWithNoFields, MyObj):
class SubclassedObject(RandomMixInWithNoFields, MyObj):
fields = {'new_field': fields.StringField()}
@ -575,13 +575,13 @@ class _TestObject(object):
'rel_objects', 'mutable_default'] +
list(base_fields))
myobj3_fields = ['new_field']
self.assertTrue(issubclass(TestSubclassedObject, MyObj))
self.assertTrue(issubclass(SubclassedObject, MyObj))
self.assertEqual(len(myobj_fields), len(MyObj.fields))
self.assertEqual(set(myobj_fields), set(MyObj.fields.keys()))
self.assertEqual(len(myobj_fields) + len(myobj3_fields),
len(TestSubclassedObject.fields))
len(SubclassedObject.fields))
self.assertEqual(set(myobj_fields) | set(myobj3_fields),
set(TestSubclassedObject.fields.keys()))
set(SubclassedObject.fields.keys()))
def test_obj_as_admin(self):
obj = MyObj(context=self.context)

View File

@ -39,7 +39,7 @@ from nova.virt.libvirt.volume import mount
MAX_WAIT = 2
class TestThreadController(object):
class ThreadController(object):
"""Helper class for executing a test thread incrementally by waiting at
named waitpoints.
@ -50,7 +50,7 @@ class TestThreadController(object):
ctl.waitpoint('bar')
final_things()
ctl = TestThreadController(test)
ctl = ThreadController(test)
ctl.runto('foo')
assert(things)
ctl.runto('bar')
@ -66,9 +66,9 @@ class TestThreadController(object):
all_threads = {}
def __init__(self, fn):
"""Create a TestThreadController.
"""Create a ThreadController.
:param fn: A test function which takes a TestThreadController as its
:param fn: A test function which takes a ThreadController as its
only argument
"""
@ -360,7 +360,7 @@ class HostMountStateTestCase(test.NoDBTestCase):
def mount_a():
# Mount vol_a from export
self._sentinel_mount(m, mock.sentinel.vol_a)
TestThreadController.current().waitpoint('mounted')
ThreadController.current().waitpoint('mounted')
self._sentinel_umount(m, mock.sentinel.vol_a)
def mount_b():
@ -374,20 +374,20 @@ class HostMountStateTestCase(test.NoDBTestCase):
def mount_d():
self._sentinel_mount(m, mock.sentinel.vol_d)
ctl_a = TestThreadController(mount_a)
ctl_b = TestThreadController(mount_b)
ctl_c = TestThreadController(mount_c)
ctl_d = TestThreadController(mount_d)
ctl_a = ThreadController(mount_a)
ctl_b = ThreadController(mount_b)
ctl_c = ThreadController(mount_c)
ctl_d = ThreadController(mount_d)
def trap_mount(*args, **kwargs):
# Conditionally wait at a waitpoint named after the command
# we're executing
TestThreadController.current().waitpoint('mount')
ThreadController.current().waitpoint('mount')
def trap_umount(*args, **kwargs):
# Conditionally wait at a waitpoint named after the command
# we're executing
TestThreadController.current().waitpoint('umount')
ThreadController.current().waitpoint('umount')
mock_mount.side_effect = trap_mount
mock_umount.side_effect = trap_umount
@ -485,7 +485,7 @@ class HostMountStateTestCase(test.NoDBTestCase):
# Mount vol on mountpoint a
self._sentinel_mount(m, mock.sentinel.vol,
mock.sentinel.mountpoint_a)
TestThreadController.current().waitpoint('mounted')
ThreadController.current().waitpoint('mounted')
self._sentinel_umount(m, mock.sentinel.vol,
mock.sentinel.mountpoint_a)
@ -496,8 +496,8 @@ class HostMountStateTestCase(test.NoDBTestCase):
self._sentinel_umount(m, mock.sentinel.vol,
mock.sentinel.mountpoint_b)
ctl_a = TestThreadController(mount_a)
ctl_b = TestThreadController(mount_b)
ctl_a = ThreadController(mount_a)
ctl_b = ThreadController(mount_b)
ctl_a.runto('mounted')
mock_mount.assert_has_calls([
@ -585,7 +585,7 @@ class MountManagerTestCase(test.NoDBTestCase):
self.host = host
self.generation = generation
ctl = TestThreadController.current()
ctl = ThreadController.current()
if ctl is not None:
ctl.waitpoint('init')
@ -617,10 +617,10 @@ class MountManagerTestCase(test.NoDBTestCase):
def txn():
with self.m.get_state():
TestThreadController.current().waitpoint('running')
ThreadController.current().waitpoint('running')
# Start a thread which blocks holding a state object
ctl = TestThreadController(txn)
ctl = ThreadController(txn)
ctl.runto('running')
# Host goes down