Skip to content

Commit

Permalink
chore: skip test_cpu_freq on macOS arm64
Browse files Browse the repository at this point in the history
macOS arm64 does not support cpu_freq: issue giampaolo#1892

Signed-off-by: mayeut <mayeut@users.noreply.github.com>
  • Loading branch information
mayeut committed Oct 18, 2022
1 parent e1e48a8 commit 41a4f4a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions psutil/tests/test_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import errno
import multiprocessing
import os
import platform
import signal
import stat
import sys
Expand Down Expand Up @@ -235,6 +236,9 @@ 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:
Expand Down
4 changes: 4 additions & 0 deletions psutil/tests/test_memleaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import functools
import os
import platform
import unittest

import psutil
Expand Down Expand Up @@ -364,6 +365,9 @@ 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)
Expand Down
3 changes: 3 additions & 0 deletions psutil/tests/test_osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

"""macOS specific tests."""

import platform
import re
import time
import unittest
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions psutil/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import datetime
import errno
import os
import platform
import pprint
import shutil
import signal
Expand Down Expand Up @@ -511,6 +512,9 @@ 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):
Expand Down

0 comments on commit 41a4f4a

Please sign in to comment.