From: Sergio Cazzolato Date: Fri, 29 Nov 2013 05:38:44 +0000 (-0500) Subject: Use assertAlmostEqual instead of failUnlessAlmostEqual in unit tests X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5896966d40884a7bdba2878386ef8f2966d08d1a;p=openstack-build%2Fcinder-build.git Use assertAlmostEqual instead of failUnlessAlmostEqual in unit tests 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 --- diff --git a/cinder/tests/api/v1/test_limits.py b/cinder/tests/api/v1/test_limits.py index b0ec31089..6c7762bb0 100644 --- a/cinder/tests/api/v1/test_limits.py +++ b/cinder/tests/api/v1/test_limits.py @@ -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.""" diff --git a/cinder/tests/api/v2/test_limits.py b/cinder/tests/api/v2/test_limits.py index 1adfb40fb..4422b15fa 100644 --- a/cinder/tests/api/v2/test_limits.py +++ b/cinder/tests/api/v2/test_limits.py @@ -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."""