From e674840916680f569994ad64a2cfefe710668c55 Mon Sep 17 00:00:00 2001 From: Hirokazu Yamamoto Date: Mon, 6 Oct 2008 04:51:11 +0000 Subject: [PATCH] Added the test for issue3762. --- Lib/test/test_platform.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 8ef34ad6174..4b4c0fa55ef 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -2,6 +2,7 @@ import sys import os import unittest import platform +import subprocess from test import support @@ -9,6 +10,21 @@ class PlatformTest(unittest.TestCase): 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() + 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): res = platform.machine()