Replace assertEquals with assertEqual - tests/scheduler
The method assertEquals has been deprecated since python 2.7. http://docs.python.org/2/library/unittest.html#deprecated-aliases Also in Python 3, a deprecated warning is raised when using assertEquals therefore we should use assertEqual instead. This is part of blueprint assertequal Change-Id: I5a6c6ac5d248ea1666f93196d21eb23e793b36d1
This commit is contained in:
@@ -165,7 +165,7 @@ class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
hosts = self.driver.select_hosts(ctxt, request_spec, {})
|
||||
self.assertEquals(['host3', 'host1'], hosts)
|
||||
self.assertEqual(['host3', 'host1'], hosts)
|
||||
|
||||
def test_select_hosts_no_valid_host(self):
|
||||
|
||||
@@ -197,12 +197,12 @@ class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
dests = self.driver.select_destinations(ctxt, request_spec, {})
|
||||
self.assertEquals(2, len(dests))
|
||||
self.assertEqual(2, len(dests))
|
||||
(host, node) = (dests[0]['host'], dests[0]['nodename'])
|
||||
self.assertEquals('host3', host)
|
||||
self.assertEqual('host3', host)
|
||||
self.assertIsNone(node)
|
||||
(host, node) = (dests[1]['host'], dests[1]['nodename'])
|
||||
self.assertEquals('host2', host)
|
||||
self.assertEqual('host2', host)
|
||||
self.assertIsNone(node)
|
||||
|
||||
def test_select_destinations_no_valid_host(self):
|
||||
|
||||
@@ -195,7 +195,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
'os_type': 'Linux'}}
|
||||
self.mox.ReplayAll()
|
||||
weighed_hosts = sched._schedule(fake_context, request_spec, {})
|
||||
self.assertEquals(len(weighed_hosts), 10)
|
||||
self.assertEqual(len(weighed_hosts), 10)
|
||||
for weighed_host in weighed_hosts:
|
||||
self.assertIsNotNone(weighed_host.obj)
|
||||
|
||||
@@ -529,9 +529,9 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
filter_properties=filter_properties)
|
||||
|
||||
# one host should be chosen
|
||||
self.assertEquals(1, len(hosts))
|
||||
self.assertEqual(1, len(hosts))
|
||||
|
||||
self.assertEquals(50, hosts[0].weight)
|
||||
self.assertEqual(50, hosts[0].weight)
|
||||
|
||||
def test_select_hosts_happy_day(self):
|
||||
"""select_hosts is basically a wrapper around the _select() method.
|
||||
@@ -572,8 +572,8 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
'os_type': 'Linux'}}
|
||||
self.mox.ReplayAll()
|
||||
hosts = sched.select_hosts(fake_context, request_spec, {})
|
||||
self.assertEquals(len(hosts), 10)
|
||||
self.assertEquals(hosts, selected_hosts)
|
||||
self.assertEqual(len(hosts), 10)
|
||||
self.assertEqual(hosts, selected_hosts)
|
||||
|
||||
def test_select_hosts_no_valid_host(self):
|
||||
|
||||
@@ -626,8 +626,8 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
self.mox.ReplayAll()
|
||||
dests = sched.select_destinations(fake_context, request_spec, {})
|
||||
(host, node) = (dests[0]['host'], dests[0]['nodename'])
|
||||
self.assertEquals(host, selected_hosts[0])
|
||||
self.assertEquals(node, selected_nodes[0])
|
||||
self.assertEqual(host, selected_hosts[0])
|
||||
self.assertEqual(node, selected_nodes[0])
|
||||
|
||||
def test_select_destinations_no_valid_host(self):
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class SchedulerOptionsTestCase(test.NoDBTestCase):
|
||||
|
||||
fake = FakeSchedulerOptions(last_checked, now, file_old, file_now,
|
||||
{}, jdata)
|
||||
self.assertEquals({}, fake.get_configuration())
|
||||
self.assertEqual({}, fake.get_configuration())
|
||||
self.assertFalse(fake.file_was_loaded)
|
||||
|
||||
def test_get_configuration_first_time_empty_file(self):
|
||||
@@ -75,7 +75,7 @@ class SchedulerOptionsTestCase(test.NoDBTestCase):
|
||||
|
||||
fake = FakeSchedulerOptions(last_checked, now, file_old, file_now,
|
||||
{}, jdata)
|
||||
self.assertEquals({}, fake.get_configuration('foo.json'))
|
||||
self.assertEqual({}, fake.get_configuration('foo.json'))
|
||||
self.assertTrue(fake.file_was_loaded)
|
||||
|
||||
def test_get_configuration_first_time_happy_day(self):
|
||||
@@ -89,7 +89,7 @@ class SchedulerOptionsTestCase(test.NoDBTestCase):
|
||||
|
||||
fake = FakeSchedulerOptions(last_checked, now, file_old, file_now,
|
||||
{}, jdata)
|
||||
self.assertEquals(data, fake.get_configuration('foo.json'))
|
||||
self.assertEqual(data, fake.get_configuration('foo.json'))
|
||||
self.assertTrue(fake.file_was_loaded)
|
||||
|
||||
def test_get_configuration_second_time_no_change(self):
|
||||
@@ -103,7 +103,7 @@ class SchedulerOptionsTestCase(test.NoDBTestCase):
|
||||
|
||||
fake = FakeSchedulerOptions(last_checked, now, file_old, file_now,
|
||||
data, jdata)
|
||||
self.assertEquals(data, fake.get_configuration('foo.json'))
|
||||
self.assertEqual(data, fake.get_configuration('foo.json'))
|
||||
self.assertFalse(fake.file_was_loaded)
|
||||
|
||||
def test_get_configuration_second_time_too_fast(self):
|
||||
@@ -118,7 +118,7 @@ class SchedulerOptionsTestCase(test.NoDBTestCase):
|
||||
|
||||
fake = FakeSchedulerOptions(last_checked, now, file_old, file_now,
|
||||
old_data, jdata)
|
||||
self.assertEquals(old_data, fake.get_configuration('foo.json'))
|
||||
self.assertEqual(old_data, fake.get_configuration('foo.json'))
|
||||
self.assertFalse(fake.file_was_loaded)
|
||||
|
||||
def test_get_configuration_second_time_change(self):
|
||||
@@ -133,5 +133,5 @@ class SchedulerOptionsTestCase(test.NoDBTestCase):
|
||||
|
||||
fake = FakeSchedulerOptions(last_checked, now, file_old, file_now,
|
||||
old_data, jdata)
|
||||
self.assertEquals(data, fake.get_configuration('foo.json'))
|
||||
self.assertEqual(data, fake.get_configuration('foo.json'))
|
||||
self.assertTrue(fake.file_was_loaded)
|
||||
|
||||
@@ -49,7 +49,7 @@ class SchedulerUtilsTestCase(test.NoDBTestCase):
|
||||
|
||||
request_spec = scheduler_utils.build_request_spec(self.context, image,
|
||||
[instance])
|
||||
self.assertEquals({}, request_spec['image'])
|
||||
self.assertEqual({}, request_spec['image'])
|
||||
|
||||
def _test_set_vm_state_and_notify(self, request_spec,
|
||||
expected_uuids):
|
||||
|
||||
Reference in New Issue
Block a user