mirror of
https://github.com/python/cpython.git
synced 2025-10-15 03:10:29 +00:00
Added the test for issue3762.
This commit is contained in:
parent
eba99dfde8
commit
e674840916
1 changed files with 16 additions and 0 deletions
|
@ -2,6 +2,7 @@ import sys
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import platform
|
import platform
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from test import support
|
from test import support
|
||||||
|
|
||||||
|
@ -9,6 +10,21 @@ class PlatformTest(unittest.TestCase):
|
||||||
def test_architecture(self):
|
def test_architecture(self):
|
||||||
res = platform.architecture()
|
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()
|
||||||
|
real = os.path.realpath(sys.executable)
|
||||||
|
link = os.path.abspath(support.TESTFN)
|
||||||
|
os.symlink(real, link)
|
||||||
|
try:
|
||||||
|
self.assertEqual(get(real), get(link))
|
||||||
|
finally:
|
||||||
|
os.remove(link)
|
||||||
|
|
||||||
def test_machine(self):
|
def test_machine(self):
|
||||||
res = platform.machine()
|
res = platform.machine()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue