Fix test suite with Python 3.12
Comparison of floats is always tricky. Use assertAlmostEqual instead of assertEqual and fix a Gabbi test with a regular expression. Change-Id: Ifa822f47830fde4cebf59a54c2c2be3ec8f2f02f
This commit is contained in:
parent
3d55ceed63
commit
313ef8b110
@ -76,7 +76,7 @@ tests:
|
|||||||
service: "cpu"
|
service: "cpu"
|
||||||
status: 200
|
status: 200
|
||||||
response_strings:
|
response_strings:
|
||||||
- "224.616"
|
- "/(224.61)(\\d)*/"
|
||||||
|
|
||||||
- name: get total for a period filtering on image service
|
- name: get total for a period filtering on image service
|
||||||
url: /v1/report/total
|
url: /v1/report/total
|
||||||
|
@ -156,7 +156,8 @@ class StorageTotalTest(StorageTest):
|
|||||||
end=end)['results']
|
end=end)['results']
|
||||||
# FIXME(sheeprine): floating point error (transition to decimal)
|
# FIXME(sheeprine): floating point error (transition to decimal)
|
||||||
self.assertEqual(1, len(total))
|
self.assertEqual(1, len(total))
|
||||||
self.assertEqual(1.9473999999999998, total[0]["rate"])
|
self.assertAlmostEqual(
|
||||||
|
1.9473999999999998, total[0]["rate"], delta=0.001)
|
||||||
self.assertEqual(begin, total[0]["begin"])
|
self.assertEqual(begin, total[0]["begin"])
|
||||||
self.assertEqual(end, total[0]["end"])
|
self.assertEqual(end, total[0]["end"])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user