From 5896966d40884a7bdba2878386ef8f2966d08d1a Mon Sep 17 00:00:00 2001 From: Sergio Cazzolato Date: Fri, 29 Nov 2013 00:38:44 -0500 Subject: [PATCH] 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 --- cinder/tests/api/v1/test_limits.py | 2 +- cinder/tests/api/v2/test_limits.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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.""" -- 2.45.2