]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Use assertAlmostEqual instead of failUnlessAlmostEqual in unit tests
authorSergio Cazzolato <sergio.j.cazzolato@intel.com>
Fri, 29 Nov 2013 05:38:44 +0000 (00:38 -0500)
committerSergio Cazzolato <sergio.j.cazzolato@intel.com>
Fri, 29 Nov 2013 05:38:44 +0000 (00:38 -0500)
The method failUnlessAlmostEqual 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
failUnlessAlmostEqual therefore we should use assertAlmostEqual instead.

Change-Id: Ic9947028afdb5b1ba8f19103018a6f1bc3fc551f
Closes-Bug: #1257068

cinder/tests/api/v1/test_limits.py
cinder/tests/api/v2/test_limits.py

index b0ec310892555b889c83de1a437fffb5d1302f51..6c7762bb0038fa5c16337d907f4bdb9c0884bced 100644 (file)
@@ -443,7 +443,7 @@ class LimiterTest(BaseLimitTestSuite):
 
         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."""
index 1adfb40fb9cae208e473a5ef32c01106d33df72c..4422b15fa289af73e5beba1cd042e2535cb8aef8 100644 (file)
@@ -448,7 +448,7 @@ class LimiterTest(BaseLimitTestSuite):
 
         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."""