import os
import unittest
import platform
+import subprocess
from test import test_support
def test_architecture(self):
res = platform.architecture()
+ if hasattr(os, "symlink"):
+ def test_architecture_via_symlink(self): # issue3762
+ def get(python):
+ cmd = [python, '-c',
+ 'import platform; print platform.architecture()']
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ return p.communicate()
+ symlink = os.path.abspath(test_support.TESTFN)
+ os.symlink(sys.executable, symlink)
+ try:
+ self.assertEqual(get(sys.executable), get(symlink))
+ finally:
+ os.remove(symlink)
+
def test_machine(self):
res = platform.machine()