summaryrefslogtreecommitdiff
path: root/Lib/test/test_platform.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-03-22 15:55:09 +0000
committerR. David Murray <rdmurray@bitdance.com>2010-03-22 15:55:09 +0000
commit587fdc655608fb5008d6e18961bdf2f48ebe5cff (patch)
tree729536f19d2e60c6e22ca3ff033d26a20f8de1fa /Lib/test/test_platform.py
parentb6bc0d524a643773b063da95db755c181f654e59 (diff)
downloadcpython-587fdc655608fb5008d6e18961bdf2f48ebe5cff.tar.gz
Issue #7860: platform.uname now reports the correct 'machine' type
when Python is running in WOW64 mode on 64 bit Windows. Patch by Brian Curtin.
Diffstat (limited to 'Lib/test/test_platform.py')
-rw-r--r--Lib/test/test_platform.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index b9f1a21123..afe304238c 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -127,6 +127,27 @@ class PlatformTest(unittest.TestCase):
res = platform.uname()
self.assertTrue(any(res))
+ @unittest.skipUnless(sys.platform.startswith('win'), "windows only test")
+ def test_uname_win32_ARCHITEW6432(self):
+ # Issue 7860: make sure we get architecture from the correct variable
+ # on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be
+ # using it, per
+ # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
+ try:
+ with test_support.EnvironmentVarGuard() as environ:
+ if 'PROCESSOR_ARCHITEW6432' in environ:
+ del environ['PROCESSOR_ARCHITEW6432']
+ environ['PROCESSOR_ARCHITECTURE'] = 'foo'
+ platform._uname_cache = None
+ system, node, release, version, machine, processor = platform.uname()
+ self.assertEqual(machine, 'foo')
+ environ['PROCESSOR_ARCHITEW6432'] = 'bar'
+ platform._uname_cache = None
+ system, node, release, version, machine, processor = platform.uname()
+ self.assertEqual(machine, 'bar')
+ finally:
+ platform._uname_cache = None
+
def test_java_ver(self):
res = platform.java_ver()
if sys.platform == 'java':