From 66fa5861d2a9c76a38f344968dbb191438afd0b0 Mon Sep 17 00:00:00 2001 From: mayeut Date: Tue, 18 Oct 2022 21:53:13 +0200 Subject: [PATCH] chore: skip test_cpu_freq on macOS arm64 macOS arm64 does not support cpu_freq: issue #1892 Signed-off-by: mayeut --- psutil/tests/test_contracts.py | 3 +++ psutil/tests/test_memleaks.py | 3 +++ psutil/tests/test_osx.py | 3 +++ psutil/tests/test_system.py | 3 +++ 4 files changed, 12 insertions(+) diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py index d376a3385..fde857b67 100755 --- a/psutil/tests/test_contracts.py +++ b/psutil/tests/test_contracts.py @@ -12,6 +12,7 @@ import errno import multiprocessing import os +import platform import signal import stat import sys @@ -235,6 +236,8 @@ def test_cpu_times_percent(self): def test_cpu_count(self): self.assertIsInstance(psutil.cpu_count(), int) + # TODO: remove this once 1892 is fixed + @unittest.skipIf(MACOS and platform.machine() == 'arm64', "skipped due to #1892") @unittest.skipIf(not HAS_CPU_FREQ, "not supported") def test_cpu_freq(self): if psutil.cpu_freq() is None: diff --git a/psutil/tests/test_memleaks.py b/psutil/tests/test_memleaks.py index e507e837c..8d31193b0 100755 --- a/psutil/tests/test_memleaks.py +++ b/psutil/tests/test_memleaks.py @@ -19,6 +19,7 @@ import functools import os +import platform import unittest import psutil @@ -364,6 +365,8 @@ def test_cpu_stats(self): self.execute(psutil.cpu_stats) @fewtimes_if_linux() + # TODO: remove this once 1892 is fixed + @unittest.skipIf(MACOS and platform.machine() == 'arm64', "skipped due to #1892") @unittest.skipIf(not HAS_CPU_FREQ, "not supported") def test_cpu_freq(self): self.execute(psutil.cpu_freq) diff --git a/psutil/tests/test_osx.py b/psutil/tests/test_osx.py index d0f588ad6..8abddb528 100755 --- a/psutil/tests/test_osx.py +++ b/psutil/tests/test_osx.py @@ -6,6 +6,7 @@ """macOS specific tests.""" +import platform import re import time import unittest @@ -144,6 +145,8 @@ def test_cpu_count_cores(self): num = sysctl("sysctl hw.physicalcpu") self.assertEqual(num, psutil.cpu_count(logical=False)) + # TODO: remove this once 1892 is fixed + @unittest.skipIf(platform.machine() == 'arm64', "skipped due to #1892") def test_cpu_freq(self): freq = psutil.cpu_freq() self.assertEqual( diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py index 753249bc3..42b29e8fa 100755 --- a/psutil/tests/test_system.py +++ b/psutil/tests/test_system.py @@ -10,6 +10,7 @@ import datetime import errno import os +import platform import pprint import shutil import signal @@ -511,6 +512,8 @@ def test_cpu_stats(self): if not AIX and name in ('ctx_switches', 'interrupts'): self.assertGreater(value, 0) + # TODO: remove this once 1892 is fixed + @unittest.skipIf(MACOS and platform.machine() == 'arm64', "skipped due to #1892") @unittest.skipIf(not HAS_CPU_FREQ, "not supported") def test_cpu_freq(self): def check_ls(ls):