python-psutil/python-psutil-add-tolerance.patch
Miro Hrončok b0b42254f1 Add tolerance to a flaky test
Resolves occasional build failure:

    ======================================================================
    FAIL: psutil.tests.test_linux.TestSystemVirtualMemory.test_total
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/builddir/build/BUILD/psutil-release-5.8.0/psutil/tests/test_linux.py", line 245, in test_total
        self.assertAlmostEqual(vmstat_value, psutil_value)
    AssertionError: 134801801216 != 134801805312 within 7 places (4096 difference)
    ----------------------------------------------------------------------
2021-04-15 17:14:57 +02:00

26 lines
991 B
Diff

From 4ffbcb458ff0b838f2bfe387b6305c4817e363ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Thu, 15 Apr 2021 17:07:38 +0200
Subject: [PATCH] Add tolerance to
test_linux.TestSystemVirtualMemory.test_total
We see this test as very flaky without tolerance in Fedora and CentOS
---
psutil/tests/test_linux.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
index 0c6d498c8..f5243c2cd 100755
--- a/psutil/tests/test_linux.py
+++ b/psutil/tests/test_linux.py
@@ -243,7 +243,8 @@ def test_total(self):
# self.assertEqual(free_value, psutil_value)
vmstat_value = vmstat('total memory') * 1024
psutil_value = psutil.virtual_memory().total
- self.assertAlmostEqual(vmstat_value, psutil_value)
+ self.assertAlmostEqual(
+ vmstat_value, psutil_value, delta=TOLERANCE_SYS_MEM)
@retry_on_failure()
def test_used(self):