From 41948490efdf7350b0b05098a5aef59361835a32 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 25 Mar 2024 07:24:20 +0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Malcolm Smith --- Doc/library/os.rst | 6 +++--- Doc/library/platform.rst | 9 +++++---- Lib/test/test_platform.py | 2 +- Lib/test/test_sysconfig.py | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 8fecfe6b28dbd6..5149ed4bad0fd8 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -785,9 +785,9 @@ process and user. ``socket.gethostbyaddr(socket.gethostname())``. On macOS, iOS and Android, this returns the *kernel* name and version (i.e., - ``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android), not the user-facing - operating system name. :func:`platform.uname()` can be used to get the - user-facing operating system name on iOS and Android. + ``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform.uname()` + can be used to get the user-facing operating system name and version on iOS and + Android. .. availability:: Unix. diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index 4b477fa80a8dd5..11ab8f46123681 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -148,8 +148,9 @@ Cross Platform Returns the system/OS name, such as ``'Linux'``, ``'Darwin'``, ``'Java'``, ``'Windows'``. An empty string is returned if the value cannot be determined. - On iOS, this returns the OS name (i.e, ``'iOS``` or ``'iPadOS'``), rather than - the kernel name (``'Darwin'``). + On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``, + ``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or + ``'Linux'``), use :func:`os.uname()`. .. function:: system_alias(system, release, version) @@ -163,8 +164,8 @@ Cross Platform Returns the system's release version, e.g. ``'#3 on degas'``. An empty string is returned if the value cannot be determined. - On iOS, this is the iOS version, not the Darwin kernel version. To obtain - the Darwin kernel version, use :func:`os.uname()`. + On iOS and Android, this is the user-facing OS version. To obtain the + Darwin or Linux kernel version, use :func:`os.uname()`. .. function:: uname() diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 49a7dfec65018d..c05fe8a81608bd 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -221,7 +221,7 @@ def test_uname(self): if sys.platform == "ios": self.assertIn(res.system, {"iOS", "iPadOS"}) - self.assertIn(res.release, platform.ios_ver().release) + self.assertEqual(res.release, platform.ios_ver().release) @unittest.skipUnless(sys.platform.startswith('win'), "windows only test") def test_uname_win32_without_wmi(self): diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 78d468736f8063..43726abe737cdd 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -485,7 +485,7 @@ def test_platform_in_subprocess(self): @unittest.skipIf(is_wasi, "Incompatible with WASI mapdir and OOT builds") @unittest.skipIf(is_apple_mobile, - f"{sys.platform} doesn't distribute config.h in the runtime environment") + f"{sys.platform} doesn't include config folder at runtime") def test_srcdir(self): # See Issues #15322, #15364. srcdir = sysconfig.get_config_var('srcdir') @@ -567,7 +567,7 @@ class MakefileTests(unittest.TestCase): 'Test is not Windows compatible') @unittest.skipIf(is_wasi, "Incompatible with WASI mapdir and OOT builds") @unittest.skipIf(is_apple_mobile, - f"{sys.platform} doesn't distribute config.h in the runtime environment") + f"{sys.platform} doesn't include config folder at runtime") def test_get_makefile_filename(self): makefile = sysconfig.get_makefile_filename() self.assertTrue(os.path.isfile(makefile), makefile)