bpo-35967: Baseline values for uname -p (GH-12824)
* Add a test intended to capture the expected values from 'uname -p' * Instead of trying to keep track of all of the possible outputs on different systems (probably a fool's errand), simply assert that except for the known platform variance, uname().processor matches the output of 'uname -p' * Use a skipIf directive * Use contextlib.suppress to suppress the error. Inline strip call.
This commit is contained in:
parent
9a4b38f66b
commit
4b4e90a518
@ -3,6 +3,8 @@ import platform
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
import collections
|
||||||
|
import contextlib
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from test import support
|
from test import support
|
||||||
@ -160,6 +162,18 @@ class PlatformTest(unittest.TestCase):
|
|||||||
self.assertEqual(res[4], res.machine)
|
self.assertEqual(res[4], res.machine)
|
||||||
self.assertEqual(res[5], res.processor)
|
self.assertEqual(res[5], res.processor)
|
||||||
|
|
||||||
|
@unittest.skipIf(sys.platform in ['win32', 'OpenVMS'], "uname -p not used")
|
||||||
|
def test_uname_processor(self):
|
||||||
|
"""
|
||||||
|
On some systems, the processor must match the output
|
||||||
|
of 'uname -p'. See Issue 35967 for rationale.
|
||||||
|
"""
|
||||||
|
with contextlib.suppress(subprocess.CalledProcessError):
|
||||||
|
self.assertEqual(
|
||||||
|
platform.uname().processor,
|
||||||
|
subprocess.check_output(['uname', '-p'], text=True).strip(),
|
||||||
|
)
|
||||||
|
|
||||||
@unittest.skipUnless(sys.platform.startswith('win'), "windows only test")
|
@unittest.skipUnless(sys.platform.startswith('win'), "windows only test")
|
||||||
def test_uname_win32_ARCHITEW6432(self):
|
def test_uname_win32_ARCHITEW6432(self):
|
||||||
# Issue 7860: make sure we get architecture from the correct variable
|
# Issue 7860: make sure we get architecture from the correct variable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user