Workaround flaky tests
This commit is contained in:
parent
0cdd22e763
commit
b5c0e1e7df
22
python-psutil-test-sum-floats-via-almost-equal.patch
Normal file
22
python-psutil-test-sum-floats-via-almost-equal.patch
Normal file
@ -0,0 +1,22 @@
|
||||
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)))
|
@ -13,6 +13,10 @@ Source0: %{url}/archive/release-%{version}/%{srcname}-%{version}.tar.gz
|
||||
# skip 2 tests that fail in mock chroots
|
||||
#
|
||||
Patch0: python-psutil-skip-tests-in-mock.patch
|
||||
#
|
||||
# avoid: AssertionError: 7883822.420000001 != 7883822.42
|
||||
#
|
||||
Patch1: python-psutil-test-sum-floats-via-almost-equal.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: grep
|
||||
|
Loading…
Reference in New Issue
Block a user