[Python-checkins] cpython (3.2): Issue #10881: Fix test_site failure with OS X framework builds.

ned.deily python-checkins at python.org
Mon Feb 6 01:00:44 CET 2012


http://hg.python.org/cpython/rev/013cba2eb008
changeset:   74803:013cba2eb008
branch:      3.2
parent:      74800:a949956a80cc
user:        Ned Deily <nad at acm.org>
date:        Mon Feb 06 00:58:18 2012 +0100
summary:
  Issue #10881: Fix test_site failure with OS X framework builds.

files:
  Lib/test/test_site.py |  23 +++++++++++++----------
  Misc/NEWS             |   2 ++
  2 files changed, 15 insertions(+), 10 deletions(-)


diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -223,7 +223,19 @@
             self.assertEqual(len(dirs), 1)
             wanted = os.path.join('xoxo', 'Lib', 'site-packages')
             self.assertEqual(dirs[0], wanted)
+        elif (sys.platform == "darwin" and
+            sysconfig.get_config_var("PYTHONFRAMEWORK")):
+            # OS X framework builds
+            site.PREFIXES = ['Python.framework']
+            dirs = site.getsitepackages()
+            self.assertEqual(len(dirs), 3)
+            wanted = os.path.join('/Library',
+                                  sysconfig.get_config_var("PYTHONFRAMEWORK"),
+                                  sys.version[:3],
+                                  'site-packages')
+            self.assertEqual(dirs[2], wanted)
         elif os.sep == '/':
+            # OS X non-framwework builds, Linux, FreeBSD, etc
             self.assertEqual(len(dirs), 2)
             wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
                                   'site-packages')
@@ -231,21 +243,12 @@
             wanted = os.path.join('xoxo', 'lib', 'site-python')
             self.assertEqual(dirs[1], wanted)
         else:
+            # other platforms
             self.assertEqual(len(dirs), 2)
             self.assertEqual(dirs[0], 'xoxo')
             wanted = os.path.join('xoxo', 'lib', 'site-packages')
             self.assertEqual(dirs[1], wanted)
 
-        # let's try the specific Apple location
-        if (sys.platform == "darwin" and
-            sysconfig.get_config_var("PYTHONFRAMEWORK")):
-            site.PREFIXES = ['Python.framework']
-            dirs = site.getsitepackages()
-            self.assertEqual(len(dirs), 3)
-            wanted = os.path.join('/Library', 'Python', sys.version[:3],
-                                  'site-packages')
-            self.assertEqual(dirs[2], wanted)
-
 class PthFile(object):
     """Helper class for handling testing of .pth files"""
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -113,6 +113,8 @@
 Library
 -------
 
+- Issue #10881: Fix test_site failure with OS X framework builds.
+
 - Issue #964437 Make IDLE help window non-modal.
   Patch by Guilherme Polo and Roger Serwy.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list