Skip to content

Commit 35ebd34

Browse files
committed
Add more tests on architecture()
1 parent a97eafd commit 35ebd34

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

Lib/test/test_platform.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,19 @@ def test_invalidate_caches(self):
121121
def test_architecture(self):
122122
res = platform.architecture()
123123

124+
if support.MS_WINDOWS:
125+
for sysconfig_platform, expected_bits in (
126+
('win32', 32),
127+
('win-amd64', 64),
128+
('win-arm32', 32),
129+
('win-arm64', 64),
130+
):
131+
with mock.patch('_sysconfig.get_platform',
132+
return_value=sysconfig_platform):
133+
bits, linkage = platform.architecture()
134+
self.assertEqual(bits, f'{expected_bits}bit')
135+
self.assertEqual(linkage, 'WindowsPE')
136+
124137
@os_helper.skip_unless_symlink
125138
@support.requires_subprocess()
126139
def test_architecture_via_symlink(self): # issue3762
@@ -372,7 +385,7 @@ def test_uname_processor(self):
372385
expect = ''
373386
self.assertEqual(platform.uname().processor, expect)
374387

375-
@unittest.skipUnless(sys.platform.startswith('win'), "windows only test")
388+
@unittest.skipUnless(support.MS_WINDOWS, "windows only test")
376389
def test_uname_win32_ARCHITEW6432(self):
377390
# Issue 7860: make sure we get architecture from the correct variable
378391
# on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be
@@ -381,11 +394,12 @@ def test_uname_win32_ARCHITEW6432(self):
381394

382395
for sysconfig_platform, arch in (
383396
('win32', 'x86'),
384-
('win-arm32', 'ARM'),
385397
('win-amd64', 'AMD64'),
398+
('win-arm32', 'ARM'),
386399
('win-arm64', 'ARM64'),
387400
):
388-
with mock.patch('_sysconfig.get_platform', return_value=sysconfig_platform):
401+
with mock.patch('_sysconfig.get_platform',
402+
return_value=sysconfig_platform):
389403
try:
390404
platform._uname_cache = None
391405
system, node, release, version, machine, processor = platform.uname()

0 commit comments

Comments
 (0)