python-psutil/python-psutil-test-sum-floats-via-almost-equal.patch

23 lines
1.0 KiB
Diff
Raw Normal View History

2023-06-14 15:49:34 +00:00
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
index 3b787ee..db22245 100755
--- a/psutil/tests/test_system.py
+++ b/psutil/tests/test_system.py
@@ -346,7 +346,7 @@ class TestCpuAPIs(PsutilTestCase):
self.assertIsInstance(cp_time, float)
self.assertGreaterEqual(cp_time, 0.0)
total += cp_time
- self.assertEqual(total, sum(times))
+ self.assertAlmostEqual(total, sum(times))
str(times)
# CPU times are always supposed to increase over time
# or at least remain the same and that's because time
@@ -385,7 +385,7 @@ class TestCpuAPIs(PsutilTestCase):
self.assertIsInstance(cp_time, float)
self.assertGreaterEqual(cp_time, 0.0)
total += cp_time
- self.assertEqual(total, sum(times))
+ self.assertAlmostEqual(total, sum(times))
str(times)
self.assertEqual(len(psutil.cpu_times(percpu=True)[0]),
len(psutil.cpu_times(percpu=False)))