Skip to content

Commit fb94040

Browse files
authored
bpo-35967: Skip test with uname -p on Android (GH-19577)
The uname binary on Android does not support -p [1]. Here is a sample log: ``` 0:06:03 load avg: 0.56 [254/421/8] test_platform failed -- running: test_asyncio (5 min 53 sec) uname: Unknown option p (see "uname --help") test test_platform failed -- Traceback (most recent call last): File "/data/local/tmp/lib/python3.9/test/test_platform.py", line 170, in test_uname_processor proc_res = subprocess.check_output(['uname', '-p'], text=True).strip() File "/data/local/tmp/lib/python3.9/subprocess.py", line 420, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/data/local/tmp/lib/python3.9/subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['uname', '-p']' returned non-zero exit status 1. ``` [1] https://android.googlesource.com/platform/external/toybox/+/refs/heads/master/toys/posix/uname.c Automerge-Triggered-By: @jaraco
1 parent 7e64414 commit fb94040

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_platform.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,11 @@ def test_uname_processor(self):
167167
On some systems, the processor must match the output
168168
of 'uname -p'. See Issue 35967 for rationale.
169169
"""
170-
proc_res = subprocess.check_output(['uname', '-p'], text=True).strip()
171-
expect = platform._unknown_as_blank(proc_res)
170+
try:
171+
proc_res = subprocess.check_output(['uname', '-p'], text=True).strip()
172+
expect = platform._unknown_as_blank(proc_res)
173+
except (OSError, subprocess.CalledProcessError):
174+
expect = ''
172175
self.assertEqual(platform.uname().processor, expect)
173176

174177
@unittest.skipUnless(sys.platform.startswith('win'), "windows only test")

0 commit comments

Comments
 (0)