diff --git a/HISTORY.rst b/HISTORY.rst index 4959d3fee..b414f30a1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -19,7 +19,7 @@ XXXX-XX-XX ``SPEED_UNKNOWN`` definition. (patch by Amir Rossert) - 2010_, [macOS]: on MacOS, arm64 ``IFM_1000_TX`` and ``IFM_1000_T`` are the same value, causing a build failure. (patch by Lawrence D'Anna) -- 2160_, [Windows]: UHandle mismatch between committed vs. used physical memory_. (patch by +- 2160_, [Windows]: Handle mismatch between committed vs. used physical memory_. (patch by Daniel Widdis) 5.9.3 diff --git a/psutil/tests/test_windows.py b/psutil/tests/test_windows.py index 17d50096c..097806361 100644 --- a/psutil/tests/test_windows.py +++ b/psutil/tests/test_windows.py @@ -163,13 +163,10 @@ def test_free_phymem(self): delta=TOLERANCE_SYS_MEM) def test_total_swapmem(self): - if (psutil.swap_memory().total > 0): - w = wmi.WMI().Win32_PerfRawData_PerfOS_Memory()[0] - self.assertEqual(int(w.CommitLimit) - - psutil.virtual_memory().total, - psutil.swap_memory().total) - else: - self.assertEqual(0, psutil.swap_memory().total) + w = wmi.WMI().Win32_PerfRawData_PerfOS_Memory()[0] + self.assertEqual(int(w.CommitLimit) - psutil.virtual_memory().total, + psutil.swap_memory().total) + if (psutil.swap_memory().total == 0): self.assertEqual(0, psutil.swap_memory().free) self.assertEqual(0, psutil.swap_memory().used)