From b470fde3d5250923c53508bd3ba6099fc788dcf4 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 21 May 2022 13:03:16 +0200 Subject: [PATCH] chore: skip test_weird_environ on macOS 11+ Signed-off-by: mayeut --- psutil/tests/__init__.py | 8 +++++++- psutil/tests/test_process.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index 6b40fdc60d..f6113c5eb9 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -18,6 +18,7 @@ import gc import inspect import os +import platform import random import re import select @@ -84,7 +85,7 @@ "HAS_CPU_AFFINITY", "HAS_CPU_FREQ", "HAS_ENVIRON", "HAS_PROC_IO_COUNTERS", "HAS_IONICE", "HAS_MEMORY_MAPS", "HAS_PROC_CPU_NUM", "HAS_RLIMIT", "HAS_SENSORS_BATTERY", "HAS_BATTERY", "HAS_SENSORS_FANS", - "HAS_SENSORS_TEMPERATURES", "HAS_MEMORY_FULL_INFO", + "HAS_SENSORS_TEMPERATURES", "HAS_MEMORY_FULL_INFO", "MACOS_11PLUS", # subprocesses 'pyrun', 'terminate', 'reap_children', 'spawn_testproc', 'spawn_zombie', 'spawn_children_pair', @@ -127,6 +128,11 @@ CI_TESTING = APPVEYOR or GITHUB_ACTIONS # are we a 64 bit process? IS_64BIT = sys.maxsize > 2 ** 32 +if MACOS: + _macos_version = platform.mac_ver()[0] + MACOS_11PLUS = tuple(map(int, _macos_version.split(".")[:2])) > (10, 15) +else: + MACOS_11PLUS = False # --- configurable defaults diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py index eb17e23939..b69678b9c3 100755 --- a/psutil/tests/test_process.py +++ b/psutil/tests/test_process.py @@ -49,6 +49,7 @@ from psutil.tests import HAS_PROC_IO_COUNTERS from psutil.tests import HAS_RLIMIT from psutil.tests import HAS_THREADS +from psutil.tests import MACOS_11PLUS from psutil.tests import PYPY from psutil.tests import PYTHON_EXE from psutil.tests import PsutilTestCase @@ -1426,6 +1427,7 @@ def clean_dict(d): @unittest.skipIf(not HAS_ENVIRON, "not supported") @unittest.skipIf(not POSIX, "POSIX only") + @unittest.skipIf(MACOS_11PLUS, "macOS 11+ not supported, issue #2084") def test_weird_environ(self): # environment variables can contain values without an equals sign code = textwrap.dedent("""