Skip to content

Commit

Permalink
Replace decprecated method aliases in tests
Browse files Browse the repository at this point in the history
Some of the TestCase methods have been deprecated since python 2.7.
We need use correct names.

http://docs.python.org/2/library/unittest.html#deprecated-aliases

* replace 'failIf' with 'assertFalse'
* replace 'failUnlessAlmostEqual' with 'assertAlmostEqual'

Change-Id: I68746f8810c17cd5456328005fc65003e57491c8
  • Loading branch information
glongwave committed Oct 8, 2013
1 parent e012b3f commit bec4d20
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion nova/tests/api/openstack/compute/plugins/v3/test_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def test_delay_POST(self):

expected = 60.0 / 7.0
results = self._check_sum(1, "POST", "/anything")
self.failUnlessAlmostEqual(expected, results, 8)
self.assertAlmostEqual(expected, results, 8)

def test_delay_GET(self):
# Ensure the 11th GET will result in NO delay.
Expand Down
2 changes: 1 addition & 1 deletion nova/tests/api/openstack/compute/test_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def test_delay_POST(self):

expected = 60.0 / 7.0
results = self._check_sum(1, "POST", "/anything")
self.failUnlessAlmostEqual(expected, results, 8)
self.assertAlmostEqual(expected, results, 8)

def test_delay_GET(self):
# Ensure the 11th GET will result in NO delay.
Expand Down
8 changes: 4 additions & 4 deletions smoketests/public_network_smoketests.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ def test_003_instance_with_group_runs_within_60_seconds(self):
else:
self.fail('instance failed to start')
ip = reservations[0].instances[0].private_ip_address
self.failIf(ip == '0.0.0.0')
self.assertFalse(ip == '0.0.0.0')
self.data['private_ip'] = ip
if FLAGS.use_ipv6:
ipv6 = reservations[0].instances[0].dns_name_v6
self.failIf(ipv6 is None)
self.assertFalse(ipv6 is None)
self.data['ip_v6'] = ipv6

def test_004_can_ssh_to_ipv6(self):
Expand Down Expand Up @@ -124,11 +124,11 @@ def test_013_instance_runs_within_60_seconds(self):
else:
self.fail('instance failed to start')
ip = reservations[0].instances[0].private_ip_address
self.failIf(ip == '0.0.0.0')
self.assertFalse(ip == '0.0.0.0')
self.data['private_ip'] = ip
if FLAGS.use_ipv6:
ipv6 = reservations[0].instances[0].dns_name_v6
self.failIf(ipv6 is None)
self.assertFalse(ipv6 is None)
self.data['ip_v6'] = ipv6

def test_014_can_not_ping_private_ip(self):
Expand Down
4 changes: 2 additions & 2 deletions smoketests/test_sysadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ def test_003_instance_runs_within_60_seconds(self):
self.fail('instance failed to start')
self.data['instance'].update()
ip = self.data['instance'].private_ip_address
self.failIf(ip == '0.0.0.0')
self.assertFalse(ip == '0.0.0.0')
if FLAGS.use_ipv6:
ipv6 = self.data['instance'].dns_name_v6
self.failIf(ipv6 is None)
self.assertFalse(ipv6 is None)

def test_004_can_ping_private_ip(self):
if not self.wait_for_ping(self.data['instance'].private_ip_address):
Expand Down

0 comments on commit bec4d20

Please sign in to comment.