[Python-3000-checkins] r66811 - python/branches/py3k/Lib/test/test_platform.py

hirokazu.yamamoto python-3000-checkins at python.org
Mon Oct 6 06:51:12 CEST 2008


Author: hirokazu.yamamoto
Date: Mon Oct  6 06:51:11 2008
New Revision: 66811

Log:
Added the test for issue3762.

Modified:
   python/branches/py3k/Lib/test/test_platform.py

Modified: python/branches/py3k/Lib/test/test_platform.py
==============================================================================
--- python/branches/py3k/Lib/test/test_platform.py	(original)
+++ python/branches/py3k/Lib/test/test_platform.py	Mon Oct  6 06:51:11 2008
@@ -2,6 +2,7 @@
 import os
 import unittest
 import platform
+import subprocess
 
 from test import support
 
@@ -9,6 +10,21 @@
     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()
 


More information about the Python-3000-checkins mailing list