]> granicus.if.org Git - python/commitdiff
Fix test_sysconfig when prefix != exec-prefix (#9100).
authorÉric Araujo <merwok@netwok.org>
Sat, 8 Oct 2011 00:49:12 +0000 (02:49 +0200)
committerÉric Araujo <merwok@netwok.org>
Sat, 8 Oct 2011 00:49:12 +0000 (02:49 +0200)
Reported by Zsolt Cserna.

Lib/test/test_sysconfig.py

index 57d1f55fc4b5a87ea3ca7a0e7d4c3bf3ea525d4f..716fa5e40e889272f582305a3466b2ddfce783db 100644 (file)
@@ -1,9 +1,5 @@
-"""Tests for 'site'.
+"""Tests for sysconfig."""
 
-Tests assume the initial paths in sys.path once the interpreter has begun
-executing have not been removed.
-
-"""
 import unittest
 import sys
 import os
@@ -259,8 +255,15 @@ class TestSysConfig(unittest.TestCase):
         # is similar to the global posix_prefix one
         base = get_config_var('base')
         user = get_config_var('userbase')
+        # the global scheme mirrors the distinction between prefix and
+        # exec-prefix but not the user scheme, so we have to adapt the paths
+        # before comparing (issue #9100)
+        adapt = sys.prefix != sys.exec_prefix
         for name in ('stdlib', 'platstdlib', 'purelib', 'platlib'):
             global_path = get_path(name, 'posix_prefix')
+            if adapt:
+                global_path = global_path.replace(sys.exec_prefix, sys.prefix)
+                base = base.replace(sys.exec_prefix, sys.prefix)
             user_path = get_path(name, 'posix_user')
             self.assertEqual(user_path, global_path.replace(base, user, 1))